dongmi4035 2012-03-30 12:41
浏览 106
已采纳

allow_url_fopen需要打开

i need to change the configuration of php.ini on server side (parameter is allow_url_fopen) from off to on but i donot have access to the php.ini file and i want to do it through php code but i dont know wat to do how to do and where to paste that code(should i place it before the headers i am using for downloading the file???)

header('Content-disposition: attachment; filename=' . basename($fileName));
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Type: application/download');
header('Content-Description: File Transfer'); 

ob_clean();
flush();
readfile($finalFileName);
exit; 

thanksss in advance

  • 写回答

4条回答 默认 最新

  • duangu9666 2012-03-30 12:46
    关注

    It is not recommended to use that option. Instead you should use the curl library.

    function getUrlContent($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,  FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置