Symfony2:主页使用/app_dev.php正确显示,但不使用/app.php


Symfony2: home page displayed properly with /app_dev.php but not with /app.php

我有一个主页位于/,在DefaultController中定义。它渲染Twig tempate。

当我使用运行应用程序时http://localhost:8000/app_dev.php/,则显示主页。

当我使用运行应用程序时http://localhost:8000/app.php/,我得到了典型的:

Welcome to Symfony 2.8.0-DEV
Your application is ready to start working on it at: /
What's next?
Read Symfony documentation to learn
...

消息。如何让app.php显示主页?

当我浏览时http://localhost:8000/我得到:

在此服务器上找不到请求的资源/。

您需要清除缓存以应用更改。

$ php app/console cache:clear --env=prod

来源:http://symfony.com/doc/current/cookbook/console/usage.html