指令“magic_quotes_gpc”在 PHP 5.3 和更高版本的 laravel 中已弃用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13545962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater laravel
提问by Anand mohan sinha
Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in laravel
指令“magic_quotes_gpc”在 PHP 5.3 中已弃用,而在 laravel 中更高
I don't have access to php.ini file at the server so i can't turn magic_quotes off, i have already tried .htaccess method it didn't work.
我无法访问服务器上的 php.ini 文件,所以我无法关闭 magic_quotes,我已经尝试过 .htaccess 方法,但它不起作用。
采纳答案by Matija
You should ask your hosting provider to turn off magic quotes.
您应该要求您的托管服务提供商关闭魔术报价。
If you can't do that, you can use this code to remove magic quotes your self:
如果你不能这样做,你可以使用这个代码来删除你自己的魔术引号:
// Remove Magic Quotes
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
Just put this code somewhere at bootstrap level, or you should put this as first code in your scripts.
只需将此代码放在引导程序级别的某个位置,或者您应该将其作为脚本中的第一个代码。
I had similar situation where I had PHP 5.3 and magic quotes turned on. Hope this helps!
我有类似的情况,我打开了 PHP 5.3 和魔术引号。希望这可以帮助!
回答by ytsejam
Your website is badly configured. Consult your hosting provider and if they don't turn it off find another host or VPS.
您的网站配置不当。咨询您的托管服务提供商,如果他们不关闭,请查找其他主机或 VPS。