【问题标题】:CodeIgniter routes.php using RegExpCodeIgniter routes.php 使用 RegExp
【发布时间】:2014-07-04 11:28:58
【问题描述】:
我有这种类型的网址:
/12,434/
routes.php 包含:
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['([0-9\,]+)']="route/index/$1";
网址 /12,434/ 打开 404 页面。如何解决?
【问题讨论】:
标签:
php
regex
codeigniter
url
【解决方案1】:
我认为您需要在字符类中包含正斜杠,
$route['([0-9\,\/]+)']="route/index/$1";
DEMO
【解决方案2】:
您应该在来自application/config/config.php 文件的 URL 中允许comma:
$config['permitted_uri_chars'] = 'a-z 0-9~%.,:_\-';
^ added here