php 大文件下载

function download($link,$destination)
{
    $array = get_headers($link,1);
    echo 'begin download: '.$link  . PHP_EOL;
    if(preg_match('/200/',$array[0])){
        $f = fopen($link, 'rb');
        if (empty($f))return false;
        $d = fopen($destination, 'a');
        while ($tmp = fread($f, 1024)){
            fwrite($d, $tmp);
        }
        return $destination;
    }else{
        echo "无效url资源!";
        return false;
    }
}
原文地址:https://www.cnblogs.com/leescre/p/10194467.html