Periods not allowed in CodeIgniter URI?

放肆的年华 提交于 2019-12-02 12:05:27
Open libraries/Input.php (system/core/Input.php in CI version 2.0+) and locate function _clean_input_keys($str){, The whole block should look like so:

function _clean_input_keys($str)
{
    if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
    {
        exit('Disallowed Key Characters.');
    }

    return $str;
}

Check if this has '.' in the preg_match. If not add it, so that your regular expression look like this-

/^[a-z0-9:_\/-\.]+$/i

Do you have the (.) in your

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

And what is your controller name ?

I think you must have the controller name in your route before the method name.

Something like this :

$route['controller_name/1.0/user/(:any)'] = ...

The problem is on line 468 of system/core/Router.php. Change set_directory from this:

$this->directory = str_replace(array('/', '.'), '', $dir).'/';

To this:

$this->directory = str_replace(array('/'), '', $dir).'/';

Anyone have a guess or gander as to why the Router removes periods from directory names?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!