Routing 具有控制器动作参数的kohana3路由问题
我在模块的init.php中定义了这个路由Routing 具有控制器动作参数的kohana3路由问题,routing,kohana-3,Routing,Kohana 3,我在模块的init.php中定义了这个路由 Route::set('store', 'store/<store_id>(/<controller>(/<action>(/<id>)))', array( 'store_id' => '\d+' )) ->defaults(array( 'controller' => 'main', 'action' => 'index', )); 使用http://mydomain.c
Route::set('store', 'store/<store_id>(/<controller>(/<action>(/<id>)))',
array(
'store_id' => '\d+'
))
->defaults(array(
'controller' => 'main',
'action' => 'index',
));
使用http://mydomain.com/item/category/8
输出: 他们指出正确的路线,这是错误的
控制器项目和方法行动类别(8) 问题是使用修改后的路线时;
http://mydomain.com/商店/1/item/category/8
输出:
它变为动作类别(1)(它从中获取参数)按名称获取参数:
$id = $this->request->param('id');
class Controller_Item extends Controller {
function action_category($category_id)
{
echo 'Category ID: '.$category_id;
}
}
Category ID: 8
Category ID: 1
$id = $this->request->param('id');