First look at the code implementation:
/* Escape the input variables. */If (! Get_magic_quotes_gpc () {If (! Empty ($ _ Get) {$ _ Get = addslashes_deep ($ _ Get);} If (! Empty ($ _ post) {$ _ post = addslashes_deep ($ _ post);} $ _ cookie = addslashes_deep ($ _ cookie ); $ _ Request = addslashes_deep ($ _ request );} /*** escape special characters in the variable in recursion mode ** @ access public * @ Param mix $ value ** @ return mix */function addslashes_deep ($ value) {If (empty ($ value) {return $ value;} else {return is_array ($ value )? Array_map ('addslashes _ deep ', $ value): addslashes ($ value );}}
Function explanation:
Get_magic_quotes_gpc ():
Function: obtain the value of magic_quotes_gpc, a PHP environment variable.
Syntax: Long get_magic_quotes_gpc (void );
Return Value: Long Integer
Function Type: PhP System Function
This function obtains the magic_quotes_gpc (GPC, get/post/cookie) value set in the PHP environment. If the return value is 0, this function is disabled. If the return value is 1, this function is enabled. When magic_quotes_gpc is enabled, all '(single quotation marks),' (double quotation marks), \ (backslash), and null characters are automatically converted to overflow characters containing the backslash.
The get_magic_quotes_gpc function is: whether to add a backslash to the double quotation mark (") or backslash (backslash) in the data sent from get, post, or cookie.
If get_magic_quotes_gpc = on, 1 is returned. The PHP parser automatically adds the Escape Character "\" to the post, get, and cookie data to ensure that the data will not cause the program, in particular, database statements may cause fatal errors due to pollution caused by special characters.
Addslashes ():
Function: uses a backslash to reference a string.
Syntax: String addslashes (string Str)
Return Value: Return string. This string must be followed by a backslash before certain characters for database query statements. These characters are single quotation marks ('), double quotation marks ("), backslash (), and (null ).