路由的问题
我在controller目录下新建了一个news目录,在news目录中新建了一个控制器news.php,访问的时候url为http://localhost/news/news/index我为了隐藏一个news,就在route.php中设置了$route['(news/.*)'] = "news/$1";
这时为什么只能通过 http://localhost/news/index访问,为不能通过http://localhost/news/来访问了,也就是说默认的index方法不会自动执行了? 多看手册
$route['news/(:any)'] = "news/$1" 还是没搞定,我按照你说的设置好,还是只能通过http://localhost/news/index访问,而不能通过http://localhost/news访问,就是说最后的那个index省略不掉 这是正则的问题,可能一条路由解决不了。
需要多写几条,我写路由也是不断调试才行的。
页:
[1]