我想添加crm作爲CRM模塊的前綴。帶前綴的ZF2路由在默認情況下不工作
這是路由器節我module.config.php
'router' => array(
'routes' => array(
'calendar' => array(
'type' => 'segment',
'options' => array(
'route' => '/crm/calendar[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Crm\Controller\Calendar',
'action' => 'index',
),
),
),
當我使用test.dev/crm/calendar/index工作正常。但它不適用於test.dev/crm/calendar。我找不到任何問題。我使用'route' => '/calendar[/:action][/:id]',
我可以使用test.dev/calendar。但我需要使用前綴。我該怎麼做?
您的路線配置是正確的,它必須是別的。爲什麼它'不工作'?你會得到什麼錯誤? – AlexP 2014-09-03 08:15:30
配置無誤。因爲它在某個網址中工作。當我使用/ crm/calender時,它不會重定向到相關操作。 – 2014-09-03 08:23:06
嘗試''route'=>'/ crm/calendar [/:action [/:id]]'' – Xerkus 2014-09-03 10:14:09