为什么我的路由代码符没有正确的动作控制器? [英] Why doesn't my route codeigniter go to correct action controller?

查看:87
本文介绍了为什么我的路由代码符没有正确的动作控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的路线

$route['posts/(:any)'] = 'posts/get_show/$1';
$route['posts/(:any)/dosomething'] ='posts/get_dosomething/$1';

控制器

public function get_show($id)
public function get_dosomething($id)

使用链接 posts / 1 / dosomething ,路由总是指向操作 get_show ,它永远不会转到 get_dosomething

With the link posts/1/dosomething, route always points to the action get_show, it never goes to get_dosomething

任何想法如何解决它?感谢

Any idea how to fix it ? Thanks

推荐答案

您必须先这样路由

$route['posts/(:any)/dosomething'] ='posts/get_dosomething/$1';
$route['posts/(:any)'] = 'posts/get_show/$1';

这篇关于为什么我的路由代码符没有正确的动作控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆