Solve the Disallowed Key Characters error message of the CI framework_PHP tutorial

WBOY
Release: 2016-07-20 11:12:50
Original
808 people have browsed it

When using the CI framework, sometimes you will encounter such a problem. When you open the web page, only the Disallowed Key Characters error message is displayed. Some people say that there are illegal characters in the url. But after making sure that the url is in pure English, the problem still arises. But after clearing browser history and cookies. Refreshing is no problem. sometimes. Open a different browser. Some browsers may have issues. Some won't.

How to solve the Disallowed Key Characters error message in the CodeIgniter framework application. Find the Input file in the /system/core folder and add the following code:

<span function</span> _clean_input_keys(<span $str</span><span )
{
    </span><span if</span> ( ! <span preg_match</span>("/^[a-z0-9:_\/-]+$/i", <span $str</span><span ))
    {
        </span><span exit</span>('Disallowed Key Characters.'<span );
    }
    </span><span //</span><span  Clean UTF-8 if supported</span>
    <span if</span> (UTF8_ENABLED === <span TRUE</span><span )
    {
        </span><span $str</span> = <span $this</span>->uni->clean_string(<span $str</span><span );
    }
    </span><span return</span> <span $str</span><span ;
}</span>
Copy after login

changed to:

<span function</span> _clean_input_keys(<span $str</span><span )   
{   
    </span><span $config</span> = &get_config('config'<span );   
    </span><span if</span> ( ! <span preg_match</span>("/^[".<span $config</span>['permitted_uri_chars']."]+$/i", <span rawurlencode</span>(<span $str</span><span )))   
    {   
        </span><span exit</span>('Disallowed Key Characters.'<span );   
    }   
    
    </span><span //</span><span  Clean UTF-8 if supported</span>
    <span if</span> (UTF8_ENABLED === <span TRUE</span><span )
    {
        </span><span $str</span> = <span $this</span>->uni->clean_string(<span $str</span><span );
    }
    </span><span return</span> <span $str</span><span ;   
}  </span>
Copy after login

Reference: http://www.nowamagic.net/librarys/veda/detail/1699

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440425.htmlTechArticleWhen using the CI framework, sometimes you will encounter such a problem. When you open the web page, only the Disallowed Key Characters error message is displayed. . Some people say that there are illegal characters in the url. But make sure the url is pure English...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template