好朋友我在Codeigniter网站上工作。我有一个类似的url
http://localhost/index.php/Medical/college/in/haryana
但是我想要
http://localhost/index.php/medical_college_in_haryana
有可能吗。
我尝试过的
$route['medical/(:any)/(:any)'] = 'medical_$1_in_$2';
您的条件不匹配,因为它不区分大小写。
$route['(?i)medical/(:any)/(:any)'] = 'medical_$1_in_$2';
(?i)表示匹配Medical、Medical等。
尝试这个
$route[':any'] = 'controller/method';
功能内
$var = explode("_", $this->uri->segment(1));
print_r(current($var));