Home  >  Article  >  Backend Development  >  Solve the Disallowed Key Characters error message of the CI framework_PHP tutorial

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

WBOY
WBOYOriginal
2016-07-20 11:12:50760browse

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>

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>

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...
Statement:
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