<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[阿Tim日志]]></title> 
<link>https://atim.cn/index.php</link> 
<description><![CDATA[专业的php开发者.开发团队的带队人]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[阿Tim日志]]></copyright>
<item>
<link>https://atim.cn/post//</link>
<title><![CDATA[php中实现断点传]]></title> 
<author>bkkkd &lt;partybase@gmail.com&gt;</author>
<category><![CDATA[开发应用]]></category>
<pubDate>Wed, 16 Nov 2005 13:12:11 +0000</pubDate> 
<guid>https://atim.cn/post//</guid> 
<description>
<![CDATA[ 
	&lt;?php<br/><br />/* <br/><br />* @url: 文件地址 <br/><br />* @filename: 要保存的文件名 <br/><br />*/ <br/><br />function _download($url, $filename) <br/><br />&#123; <br/><br />// 获得文件大小, 防止超过2G的文件, 用sprintf来读 <br/><br />$filesize = sprintf(&quot;%u&quot;, filesize($url)); <br/><br /><br/><br />if (!$filesize) <br/><br />&#123; <br/><br />return; <br/><br />&#125; <br/><br /><br/><br />header(&quot;Content-type:application/x-msdownload\n&quot;); //application/octet-stream <br/><br />header(&quot;Content-type:unknown/unknown;&quot;); <br/><br />header(&quot;Content-disposition: inline; filename=\&quot;&quot;.$filename.&quot;\&quot;&quot;); <br/><br />header('Content-transfer-encoding: binary'); <br/><br /><br/><br />if ($range = getenv('HTTP_RANGE')) // 当有偏移量的时候，采用206的断点续传头 <br/><br />&#123; <br/><br />$range = explode('=', $range); <br/><br />$range = $range[1]; <br/><br /><br/><br />header(&quot;HTTP/1.1 206 Partial Content&quot;); <br/><br />header(&quot;Date: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;) . &quot; GMT&quot;); <br/><br />header(&quot;Last-Modified: &quot;.gmdate(&quot;D, d M Y H:i:s&quot;, filemtime($url)).&quot; GMT&quot;); <br/><br />header(&quot;Accept-Ranges: bytes&quot;); <br/><br />header(&quot;Content-Length:&quot;.($filesize - $range)); <br/><br />header(&quot;Content-Range: bytes &quot;.$range.($filesize-1).&quot;/&quot;.$filesize); <br/><br />header(&quot;Connection: close&quot;.&quot;\n\n&quot;); <br/><br />&#125; <br/><br />else <br/><br />&#123; <br/><br />header(&quot;Content-Length:&quot;.$filesize.&quot;\n\n&quot;); <br/><br />$range = 0; <br/><br />&#125; <br/><br /><br/><br />$fp = fopen($url, 'rb'); <br/><br />fseek($fp, $range); <br/><br />while ($bbsf = fread($fp, 4096)) <br/><br />&#123; <br/><br />echo $bbsf; <br/><br />&#125; <br/><br />fclose($fp); <br/><br /><br/><br />&#125;<br/><br />?&gt;<br/><br/>
]]>
</description>
</item><item>
<link>https://atim.cn/post//#blogcomment</link>
<title><![CDATA[[评论] php中实现断点传]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://atim.cn/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>