首页 > 代码库 > curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in
curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in
当系统开启safe_mode和 open_basedir,在程序中使用以下语句
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
并且遇到301,302状态吗时会出现错误
[11-Oct-2010 14:17:41] PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in msn.class.php on line 819
解决方法是在curl语句不使用curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true),或者改为0,在php函数中自定义一个函数
curl_redir_exec函数
curl_redir_exec
curl_redir_exec($ch)替换curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)语句
参考:
http://spoint.babyshoot.cn/archives/2009/11/curlopt-php.html
http://www.php.net/manual/en/function.curl-setopt.php
curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。