【发布时间】:2015-03-06 02:02:18
【问题描述】:
我在cakephp下的路由遇到了一些问题 我的控制器中有两个动作 它们如下:
example.com/posts/show/show-by-day
example.com/posts/view/slug-post
我希望它们为:
example.com/article/show-by-day.html
example.com/article/slug-post.html
所以我在我写的配置文件下路由文件:
Router::connect('/article/:show_by_day', array('controller' => 'posts', 'action' => 'show'), array('pass' => array('show_by_day')));
Router::connect('/article/:slug', array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug')));
当我点击 URL example.com/article/show-by-day.html 时它工作正常
但是当我点击 url example.com/article/slug-post.html 时,它又指向了动作展示。
那我该如何解决呢? 非常感谢!
【问题讨论】: