Phpaddslashessql anti-injection function. Addslashes can automatically add single quotation marks and double quotation marks, so that we can securely store data into the database without being exploited by hackers. * When the. z parameter defines all uppercase and lowercase letters, addslashes can automatically enclose single quotation marks and add "\" to double quotation marks. in this way, we can securely store data in the database without being exploited by hackers. * /// Parameter 'a .. z' defines that all uppercase and lowercase letters are escaped echo addcslashes ('foo [] ', 'a .. z'); // output: foo []
Addslashes can automatically add single quotation marks and double quotation marks, so that we can securely store data into the database tutorial without being exploited by hackers.
*/
// The parameter 'A. Z' defines that all uppercase and lowercase letters are escaped.
Echo addcslashes ('foo [] ', 'A. z'); // output: foo []
//
$ Str = "is your name o 'Reilly? "; // Define a string, including characters to be escaped
Echo addslashes ($ str); // output the escaped string
/*
Definition and usage
The addslashes () function adds a backslash before the specified predefined character.
The predefined characters are:
Single quotes (')
Double quotation marks (")
Backslash ()
Null
Syntax
Addslashes (string)
*/
// Of course, this function is safer
$ Str = "test"; // define a string containing special characters
$ New = htmlspecialchars ($ str, ent_quotes); // Convert
Echo $ new; // output the conversion result
// Used for output
$ Str = "jane & 'tarzance'"; // defines an html string.
Echo html_entity_decode ($ str); // output the converted content
Echo"
";
Echo html_entity_decode ($ str, ent_quotes); // optional parameter output
Bytes. * /// Parameter A. z defines all uppercase and lowercase letters...