【问题标题】: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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-01-09
        • 2014-01-17
        • 1970-01-01
        • 2019-08-23
        • 1970-01-01
        • 1970-01-01
        • 2012-09-08
        相关资源
        最近更新 更多