Lea*_*tro 1 php regex routes codeigniter
我有这个:
$route['^[a-zA-Z]{2}$'] = "state";
$route['^[a-zA-Z]{2}$/(:any)'] = "state/city";
而这些控制器
状态文件
class State extends CI_Controller {
    public function index () 
    {
        echo "OK"; 
    } 
    public function city () 
    {
       echo "Not OK"; 
    } 
}
第一条路线完美无缺,而第二条路线则不然。她应该调用State类的城市方法却没有调用!
网址:
http://foo.bar/SP/ ---> 好的
http://foo.bar/SP/SANTOS -> 404!
删除$锚定到字符串末尾的那个:
$route['^[a-zA-Z]{2}/(:any)'] = "state/city";
| 归档时间: | 
 | 
| 查看次数: | 3678 次 | 
| 最近记录: |