Error message about solving disallowed key characters of Ci framework

Source: Internet
Author: User

When using the CI framework, you may encounter such a problem. When you open a webpage, only the error message "disallowed key characters" is displayed. Some people say that the URL contains invalid characters. But make sure that the URL is in English only. However, after clearing the browser history and cookies. Refresh. Sometimes. Open different browsers. Some browsers have problems. Some won't. Bo E baientertainment City

Solution: the error message "disallowed key characters" appears in the codeigniter framework application. Find the input file in the core folder and run the following code:

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

Changed to this:

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

Or change:

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

This is probably the case ~ Keep a record.

Error message about solving disallowed key characters of Ci framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.