When the form is submitted during Project creation, the prompt CI framework of DisallowedKeyCharacters appears.
Open the source code of the ci framework and it is not difficult to find that there is such a function in the core input class of the ci:
The code is 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 for filtering, so an error is thrown.
We can rewrite this method in the application core.
Name MY_Input.php (the prefix MY _ can be customized in config. php) and add the following code.
The code is as follows:
Class AI_Input extends CI_Input {
// Constructor
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;
}
}