两个不同控制器的不同路由

时间:2014-03-24 03:51:21

标签: cakephp controller routing

我有两个不同的控制器, AdminController.php和 HomeController.php

我只想为HomeController.php函数添加路由。我为HomeContrller.php函数添加了Router :: connect()函数,它运行正常。 但是我的AdminController.php现在无法正常工作:(。

我的问题是,如果我们有两个控制器,我想只为一个控制器功能添加路由。我们怎么做呢?

请帮忙。

1 个答案:

答案 0 :(得分:0)

在routes.php中,只需指定控制器和操作即可。例如:

Router::connect('/profile/*', array('controller' => 'users', 'action' => 'profile'));
//the * means anything after the slash....www.example.com/profile/123
相关问题