Periods not allowed in CodeIgniter URI?

后端 未结 3 1365
粉色の甜心
粉色の甜心 2021-01-29 05:18

So after reading this question on API versioning, I decided to prefix all my routes with a version number:

http://localhost/api/1.0/user/login

3条回答
  •  佛祖请我去吃肉
    2021-01-29 05:23

    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
    

提交回复
热议问题