"CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set" 问题


在使用 curl 时出现报错:

CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in ...

 

 

safe_mode:PHP安全模式,当开启时一些PHP函数将被禁用

open_basedir:   将用户访问文件的活动范围限制在指定的区域  如 open_basedir=.:/tmp 或是具体 /var/tmp

解决方法:

if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

}

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM