0
路由匹配我有這樣的路線:所請求的網址無法通過ZF2
'editRelationship' => array(
'type' => 'Segment',
'options' => array(
'route' => '/editRelationship[/:state]',
'constraints' => array(
'state' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'User\Controller\Admin',
'action' => 'editRelationship',
),
),
),
這是我的動作控制器:
public function editRelationshipAction() {
$state = $this->params()->fromRoute('state', null);
$viewModel = new ViewModel();
$viewModel->setVariable('state', $state);
return $viewModel;
}
我嘗試訪問的URL,但每當我m訪問它我總是得到:
請求的URL不能通過路由匹配。
我可以知道我的路線有什麼缺失或錯誤嗎?
在此先感謝。
你是如何訪問該路線? (URL) – blackbishop
除了上面的內容,你還應該添加整個路徑到你的問題(如果'editRelationship'路線是另一個孩子可能會改變你的答案) – AlexP
嗨!是的,我的問題確實出現在我的整個路線上,我創建的路線應該在孩子路線上。多謝你們! – Dave