[英]How to start Symfony through app.php?
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
AcmeDemoBundle
僅在AppKernel
針對dev
和test
環境激活:
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
}
如果要通過app.php
(用於prod
環境)訪問它,則需要將捆綁軟件激活移出條件。
AFAIK,假設您知道哪些捆綁包不用於生產,則可以在getEnvironment()
選項數組中添加生產。
有一個單獨的條件來檢查其開發或測試是否其他不屬於產品的捆綁軟件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.