我正在按照有关创建示例应用程序的说明进行操作。我正在尝试快速掌握如何创建一些(目前)静态页面 - 没有用户身份验证,没有 ORM 等,只是为了让一些东西启动并运行。
我创建了两个捆绑包:
$ php app/console generate:bundle --namespace=app1/FooBundle --format=yml
$ php app/console generate:bundle --namespace=app2/FooBarBundle --format=yml
根据文档(以及 Symfony 1.x 如何工作的知识),我希望能够使用以下方式访问这两个“应用程序”:
http://sf2.examples.localhost/app_dev.php/app1/hello/angrycoder
http://sf2.examples.localhost/app_dev.php/app2/hello/angrycoder
但是,在这两种情况下,我都收到了 404 错误。
回到文档后,我读到要使用的正确 URL 是;
http://sf2.examples.localhost/app_dev.php/hello/angrycoder
就显示带有angrycoder的页面而言,这似乎是“有效的” 。
但是 - 我不知道实际调用了哪个应用程序 - 因为我还没有弄清楚如何显示调试工具栏。
因此,我的问题是:
- 如何访问给定捆绑包中的特定页面(静态或其他)?
[[编辑]]
This is what my app/config/routing.yml file looks like:
app1CoreBundle:
resource: "@app1CoreBundle/Resources/config/routing.yml"
prefix: /
app2CoreBundle:
resource: "@app2CoreBundle/Resources/config/routing.yml"
prefix: /
# Internal routing configuration to handle ESI
#_internal:
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
# prefix: /_internal
可以看出,两者都有一个前缀'/'。所以当我输入:
http://sf2.examples.localhost/app_dev.php/hello/angrycoder
实际调用了哪个应用程序(为什么?)。
据我了解,能够调用特定应用程序的唯一(显而易见的方式)是为不同的应用程序使用不同的前缀 - 还是我遗漏了什么?