我有以下的module.config.php配置Zend的重定向不工作
'router'=>array(
'routes'=>array(
'test'=>array(
'type'=>'Zend\Mvc\Router\Http\Literal',
'options'=>array(
'route'=>'/test',
'defaults'=>array(
'controller'=>'Test\Controller\Index',
'action'=>'index'
)
),
'may_terminate' => true,
'child_routes' => array(
'edit' => array(
'type' => 'segment',
'options' => array(
'route' =>'/edit[/:id]',
'constraints' =>array('id' => '[\d\w\-_]*'),
'defaults' => array(
'controller' =>'Test\Controller\Index',
'action' => 'edit',
),
),
),
'add' => array(
'type' => 'segment',
'options' => array(
'route' =>'/add',
'defaults' => array(
'controller' =>'Test\Controller\Index',
'action' => 'add',
),
),
),
),
)
)
)
現在
我使用以下重定向
回報$這個 - >重定向() - > toRoute( '測試') ;
它不起作用。我沒有得到什麼不對這個
你說的「不工作」的意思。你有什麼錯誤嗎?頁面是否正常顯示?你有空的頁面嗎?我們需要更多信息。 –
我在調用保存功能後重定向頁面。功能正常執行。字段反映在數據庫中。但瀏覽器顯示相同的頁面,它不會重定向到所需的位置。 –
好的。你能告訴我們實際的代碼嗎?這個配置對我們來說不是很有幫助。 –