Browsing the online project yesterday, a problem was found: a backslash was added to the quotation marks in some text output, such as:
The quotation marks are much more \ "backslash \"
Judging from the results of the page, the guess should be the reason why the MAGIC_QUOTES_GPC configuration in PHP is turned on. Then check the next program, found in the portal file, has been dynamically closed this configuration:
Ini_set (' magic_quotes_gpc ', ' Off ');
Why didn't it take effect?
After some searching, the colleague helped to find the reason because the request was parsed before I changed the configuration dynamically, so the modification was not effective for the time of the request.
See the following page, a colleague also encountered the same problem:
https://bugs.php.net/bug.php?id=32867
MAGIC_QUOTES_GPC is applied while parsing the request before your PHP script gets control So while your can change this set Ting in your script, it won ' t has any effect.
Since there are multiple projects on the server, we cannot directly modify the configuration of the php.ini in order to not affect other projects, so we use the code written by strangers vs recall and recursively process the GPC content:
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] = str Ipslashesrecursive ($v); } } return $array; } $_get = stripslashesrecursive ($_get); $_post = stripslashesrecursive ($_post);}