[英]cakephp, How to change controller url name
Is there a way to change name of generated url based of controller eg: if i visit controller ArticlesController
and action of it add
url generated is /articles/add
. 有没有一种方法可以更改基于控制器的生成的url的名称,例如:如果我访问控制器
ArticlesController
并对其进行操作,则add
生成的URL是/articles/add
。 Can i change it somehow ? 我可以以某种方式更改它吗? To look like this
/pages/add
看起来像这样
/pages/add
Yes, you can change it. 是的,您可以更改它。 On
routes.php
, you can add a connection route: 在
routes.php
,您可以添加连接路由:
Router::connect('pages/:action', array('controller' => 'articles'));
Please look at the documentation for further information: http://book.cakephp.org/2.0/en/development/routing.html 请查看文档以获取更多信息: http : //book.cakephp.org/2.0/en/development/routing.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.