codeigniter url路由404错误

时间:2015-03-28 07:47:45

标签: php codeigniter routing

美好的一天朋友 我正在使用Codeigniter网站。我有这样的网址

http://localhost/index.php/Medical/college/in/haryana

但我想要

http://localhost/index.php/medical_college_in_haryana

是否可能。

我尝试了什么

$route['medical/(:any)/(:any)'] = 'medical_$1_in_$2';

2 个答案:

答案 0 :(得分:0)

您的情况不符合,因为它不区分大小写。

$route['(?i)medical/(:any)/(:any)'] = 'medical_$1_in_$2';
<?>(?i)表示匹配Medical,mEDiCal等

答案 1 :(得分:0)

试试这个

$route[':any'] = 'controller/method';

在功能

$var = explode("_", $this->uri->segment(1));
print_r(current($var));