Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为 URL 设置 cakephp 路由,如下所示:/param1/contorllername/actionname/ 我该怎么做,如果我这样做,如何使用$this->redirect(array('controller'=>$controllername,'action'=>$actionname))重定向我的页面。同样,我如何使用$this->Html->link此网址。
$this->redirect(array('controller'=>$controllername,'action'=>$actionname))
$this->Html->link
你可以在你的 routes.php 中定义它
Router::connect( '/:param1/:controller/:action', array(), array('pass' => array('param1')) );
然后你可以像这样声明路由
$this->redirect(array('controller'=>'posts','action'=>'view','param1'=>10))
这将重定向到 /10/posts/view