Home  >  Q&A  >  body text

PHP download larger zip file is not fully downloaded

       //下载zip包
        $url = dirname($url) . '/' .$str_name['filename'] . '.zip';
        $origin_size = get_headers($url,(bool)1);
        $origin_size = $origin_size['Content-Length']??0;


        $ch = curl_init($url);
        //设置抓取的url
        $dir = $upload_dir.'/' . $file_name;
        $fp = fopen($dir, "wb");
        curl_setopt($ch, CURLOPT_FILE, $fp);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $content = curl_exec($ch);
        curl_close($ch);
        fclose($fp);


ゞ   ꪱꪷ ꪶꪮꪜꫀ ꪑꫀゞ   ꪱꪷ ꪶꪮꪜꫀ ꪑꫀ417 days ago335

reply all(0)I'll reply

No reply
  • Cancelreply