CodeIgniter Framework hints disallowed Key characters Solution _php Instance

Source: Internet
Author: User
Tags codeigniter

Open the CI framework of the source code is not difficult to find, in the CI of the core input class has such a function:

Copy Code code as follows:

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

Clean UTF-8 if supported
if (utf8_enabled = = TRUE)
{
$str = $this->uni->clean_string ($STR);
}

return $str;
}

This is filtered so that the error is thrown

We rewrite this method in the core of application.
Name a my_input.php (prefix My_ can be customized in config.php), and then add the following code

Copy Code code as follows:

Class Ai_input extends Ci_input {

Constructors
function __construct () {
Parent::__construct ();
}

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;
}
}

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.