您正在经历 PHP 魔术引号的痛苦。您应该关闭它们(首选)或去掉斜线。有关详细信息,请参阅http://php.net/manual/en/security.magicquotes.php。
要完全禁用它们,请将其放入您的 php.ini 文件中
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
要从 $_GET 变量中删除它们,请使用 stripslashes。
<?php
// from http://www.php.net/manual/en/security.magicquotes.disabling.php#91585
if (get_magic_quotes_gpc()) {
function stripslashes_gpc(&$value)
{
$value = stripslashes($value);
}
array_walk_recursive($_GET, 'stripslashes_gpc');
array_walk_recursive($_POST, 'stripslashes_gpc');
array_walk_recursive($_COOKIE, 'stripslashes_gpc');
array_walk_recursive($_REQUEST, 'stripslashes_gpc');
}
?>