1
我已經定義了兩個路由,/ shoppingcart /和一個子路由/ shoppingcart/add /,它們只能用於POST請求。Zend Mvc Router Http 方法和子路由
'routes' => array(
'shoppingcart' => array(
'type' => 'literal',
'options' => array(
'route' => '/shoppingcart/',
'defaults' => array(
'controller' => 'ShoppingcartController',
'action' => 'shoppingcart',
),
),
'may_terminate' => true,
'child_routes' => array (
'add-product' => array(
'type' => 'method',
'options' => array(
'verb' => 'post',
'route' => 'add/',
'defaults' => array(
'controller' => 'ShoppingcartController',
'action' => 'addProductToShoppingcart',
),
),
),
)
),
)
路線/ shoppingcart /工作正常。子路由/ shoppingcart/add /不起作用(POST和GET發生404錯誤)。
當我從方法更改類型到文字並刪除它的動詞鍵它的作品。
如何在子路徑中使用Zend \ Mvc \ Router \ Http \ Method?
我首先認爲這將修復它,但我喜歡的類型設置爲文本。它仍然具有與type = literal類似的行爲,但不具有type = method。 – Weteef 2013-03-22 09:52:09
@ Weteef,對不起,請參閱編輯的版本 – Crisp 2013-03-22 17:09:03
太棒了,它的工作原理!非常感謝! – Weteef 2013-03-23 10:52:01