【发布时间】:2012-10-02 08:12:17
【问题描述】:
http://localhost/Symfony/web/app.php/demo/hello/Alex
显示
“无法从“D:/UserData/WWWRoot/Symfony/app/config/routing.yml”导入资源“@AcmeDemoBundle/Controller/SecuredController.php”。确保“AcmeDemoBundle/Controller/SecuredController.php”包在应用程序内核类中正确注册和加载。”
这是我app\config\routing.yml的路线
处理 ESI 的内部路由配置
_internal:
resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
prefix: /_internal
_welcome:
pattern: /
defaults: { _controller: AcmeDemoBundle:Welcome:index }
_demo_secured:
resource: "@AcmeDemoBundle/Controller/SecuredController.php"
type: annotation
_demo:
resource: "@AcmeDemoBundle/Controller/DemoController.php"
type: annotation
prefix: /demo
【问题讨论】:
-
你试过
app/console router:debug吗?看看路线是否设置正确? -
怎么样?我在 Windows 上使用 Apache,我从 app\config\routing_DEV.yml 复制了路由
-
那么你的问题到底是什么?
-
如何解决“D:/UserData/WWWRoot/Symfony/app/config/routing.yml”中的“无法导入资源“@AcmeDemoBundle/Controller/SecuredController.php”问题。确保“AcmeDemoBundle/Controller/SecuredController.php”包已正确注册并加载到应用程序内核类中。""
-
检查系统环境变量
PATH是否包含你的php文件夹。我猜 xampp 在安装过程中会这样做,但我不确定。您可以通过在命令行中调用php -v来测试它。如果它有效,即您看到一些版本信息,请导航到项目的根目录并输入php app\console router:debug --env=prod这应该会打印生产环境中可用的所有路由,即可以通过 app.php 访问的路由。如果缺少某些内容,请尝试php app\console cache:clear --env=prod更新缓存,如果这无济于事,请返回报告