开发者

cakePHP - how to ovveride the default routing?

I have a controller, and I have several aliases for a single function in it. eg:

Router::connect(
   '/controllerX/:method', 
   array('controller' => 'controllerX', 'action' => 'bigApple'),
   array('method'=>'help|ask|read', pass => array(method))
 );

Now, for some reason(don't ask..) I want to keep the original methods in the controller, but I don't want them to be available for direct access. Meaning: in the controller there will be functions named: ask,help, and read, but they won't be accessible for direct call.

if someone will enter the url /controllerX/ask, or /controllerX/help, i want him to be routed to somewhere else.

is it possib开发者_如何学运维le at all? (it seems like an endless loop..)


I think in your case, you have to do a check before and redirect to Controller:: setAction

Checkout: http://api.cakephp.org/class/controller#method-ControllersetAction

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜