当路由url以变量开头时,我在codeigniter路由上遇到问题,如下面的那样 -
$route['(:any)/(:any)'] = "home/index/0/N/DealsAmount/ASC/$1/$2";
当我通过url传递值时,我可以配置其他路由URL。 例: 事情顺利完成
$route['About-Us/Team'] = "aboutus/team";
$route['About-us/Jobs'] = "aboutus/jobs";
$route['About-Us/FAQ'] = "aboutus/faq";
但我使用这个url使用varible如下 -
$route['About-Us/Team/(:any)'] = "aboutus/team/$1";
$route['About-Us/Team/(:any)/(:any)'] = "aboutus/team/$1/$2";
$route['About-us/Jobs/(:any)'] = "aboutus/jobs/$1";
$route['About-Us/FAQ/(:num)'] = "aboutus/faq/$1";
然后它重定向到主页,这意味着这个路由不起作用$ route ['(:any)/(:any)']正在工作如何能够解决这些类型的网址你可以告诉我
答案 0 :(得分:1)
您必须将:any
的路线放在底部。如果你把它放在顶部,其他路线永远不会被抓住。这应该没问题:
$route['About-Us/Team/(:any)/(:any)'] = "aboutus/team/$1/$2";
$route['About-Us/Team/(:any)'] = "aboutus/team/$1";
$route['About-us/Jobs/(:any)'] = "aboutus/jobs/$1";
$route['About-Us/FAQ/(:num)'] = "aboutus/faq/$1";
$route['(:any)/(:any)'] = "home/index/0/N/DealsAmount/ASC/$1/$2";