我正在关注symfony的教程,并遇到了障碍.
我的设置是xampp的当前版本(在Windows上运行),所以我的apache和php是相对最新的.
跟随他们的"快速之旅":
http://symfony.com/doc/current/quick_tour/the_big_picture.html
在开发环境中一切都很好.然后,按照指南更进一步,我开始通过这里的指南创建我自己的测试包:
http://symfony.com/doc/current/book/page_creation.html
并且无法让它在生产环境中正常工作.(它在开发环境中工作正常,就像预装的演示一样.
我已经尝试通过php app/console cache清除缓存:clear --env = prod --no-debug命令,但这没有帮助(而且似乎也是搜索时弹出的唯一建议.
在查看路线时,我可以看到我的"/ hello/{name}"路线在路线列表中显示正常.
我的app/config/routing.yml有:
acme_hello:
resource: "@AcmeHelloBundle/Resources/config/routing.yml"
prefix: /
Run Code Online (Sandbox Code Playgroud)
应该是,然后我的src/Acme/HelloBundle/Resources/config/routing.yml有
hello:
path: /hello/{name}
defaults: { _controller: AcmeHelloBundle:Hello:index }
Run Code Online (Sandbox Code Playgroud)
有没有人对这个问题有什么建议?(我也尝试将开箱即用的演示转换为生产路线,通过从routing_dev.yml文件复制路径信息并在appkernel.php文件中重新分配捆绑包,但这有同样的问题)
- -编辑 - -
每个请求,这是我的appkernel.php文件
使用Symfony\Component\HttpKernel\Kernel; 使用Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\AopBundle\JMSAopBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Acme\HelloBundle\AcmeHelloBundle(),
new Acme\DemoBundle\AcmeDemoBundle(),
);
if (in_array($this->getEnvironment(), …Run Code Online (Sandbox Code Playgroud) symfony ×1