"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