gpt4 book ai didi

php - 使用 parse_str 时防止自动添加斜杠

转载 作者:可可西里 更新时间:2023-11-01 13:48:39 24 4
gpt4 key购买 nike

我的托管服务器上有 magic_quotes。所以当我使用 parse_str 时,它也会添加斜线。所以数据被存储为\\'name ..我该如何防止这种情况。?

最佳答案

// Turn off magic_quotes_runtime
if (get_magic_quotes_runtime())
set_magic_quotes_runtime(0);

// Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
if (get_magic_quotes_gpc())
{
function stripslashes_array($array)
{
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
}

$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
}

关于php - 使用 parse_str 时防止自动添加斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3117512/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com