简体   繁体   English

codeigniter 3.1.11 带有路由的动态 url 但显示 404

[英]codeigniter 3.1.11 dynamic url with route but showing 404

I have a problem regarding routes on CI 3.1.11 , here's what I want to happen:我在CI 3.1.11上遇到路由问题,这是我想要发生的事情:

url: http://myurl.local/1/settings/company/ url: http://myurl.local/1/settings/company/detial网址: http://myurl.local/1/settings/company/网址: http://myurl.local/1/settings/company/detial

The 1 is an ID , then settings is a dir, company is the controller and detail is a function. 1是一个ID ,然后settings是一个目录, company是控制器, detail是一个函数。 I just want to make the segment(1) or the ID as a dynamic value, but the routes will show me 404 .我只想将 segment(1) 或 ID 作为动态值,但路由会显示404 :( help me with this, please. :( 请帮我解决这个问题。

here's what i did to my route:这是我对我的路线所做的:

$route['([A-Za-z0-9_.])+/(:any)'] = "$2";

thanks!谢谢!

您应该在路由中提及控制器和方法名称,如下所示

$route['([A-Za-z0-9_.])+/(:any)'] = "Controller/method/$2";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM