How to understand this sentence if (ini_get ('Magic _ quotes_gpc '))
And the following section
If (ini_get ('Magic _ quotes_gpc ')){
Function stripslashesRecursive (array $ array ){
Foreach ($ array as $ k => $ v ){
If (is_string ($ v )){
$ Array [$ k] = stripslashes ($ v );
} Else if (is_array ($ v )){
$ Array [$ k] = stripslashesRecursive ($ v );
}
}
Return $ array;
}
Reply to discussion (solution)
(Ini_get ('Magic _ quotes_gpc ') // gets the value of a configuration option
The following function uses addslashes () to recursively escape strings in a multi-dimensional array, that is, to use the addslashes function to process all strings in the array.
1. for PHP magic_quotes_gpc = on, we can perform the addslashes () and stripslashes () operations on the string data of the input and output databases, and the data will be displayed normally.
If you have performed addslashes () processing on the input data at this time, you must use stripslashes () to remove unnecessary backslash when outputting the data.
2. PHP magic_quotes_gpc = off
You must use addslashes () to process the input data, but do not use stripslashes () to format the output. because addslashes () does not write the backslash together into the database, it only helps mysql to complete SQL statement execution.
Reference: http://developer.51cto.com/art/200911/165392.htm
(Ini_get ('Magic _ quotes_gpc ') // gets the value of a configuration option
The following function uses addslashes () to recursively escape strings in a multi-dimensional array, that is, to use the addslashes function to process all strings in the array.
I spoke quite well and hope to make persistent efforts