PHP下载远程文件类(支持断点续传)
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-26
p; header("HTTP/1.0 206 Partial Content"); header("Status: 206 Partial Content"); header(''Accept-Ranges: bytes''); header("Content-Range: bytes $seek_start-$seek_end/$size"); header("Content-Length: " . ($seek_end - $seek_start + 1)); } else { header("Content-Length: $size"); } } function download_ex($size) { if (!$this->initialize()) return false; ignore_user_abort(true); //Use seek end here if ($this->seek_start > ($size - 1)) $this->seek_start = 0; if ($this->seek_end <= 0) $this->seek_end = $size - 1; $this->header($size,$seek,$this->seek_end); $this->data_mod = time(); return true; } function download() { if (!$this->initialize()) return false; try { error_log("begin download\n", 3,"/usr/local/www/apache22/LOGS/apache22_php.err"); $seek = $this->seek_start; $speed = $this->speed; $bufsize = $this->bufsize; $packet = 1; //do some clean up @ob_end_clean(); $old_status = ignore_user_abort(true); @set_time_limit(0); $this->bandwidth = 0; $size = $this->data_len; if ($this->data_type == 0) //download from a file { $size = filesize($this->data); if ($seek > ($size - 1)) $seek = 0; |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于PHP下载远程文件类(支持断点续传)的所有评论