色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php實現下載限制速度示例分享

復制代碼 代碼如下:
// local file that should be send to the client
$local_file = 'test-file.zip';

// filename that the user gets as default
$download_file = 'your-download-name.zip';

// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5;

if(file_exists($local_file) && is_file($local_file)) {

 // send headers
 header('Cache-control: private');
 header('Content-Type: application/octet-stream');
 header('Content-Length: '.filesize($local_file));
 header('Content-Disposition: filename='.$download_file);

 // flush content
 flush();

 // open file stream
 $file = fopen($local_file, "r");

 while (!feof($file)) {

 // send the current file part to the browser
 print fread($file, round($download_rate * 1024));

 // flush the content to the browser
 flush();

 // sleep one second
 sleep(1);
 }

 // close file stream
 fclose($file);

}

else {
 die('Error: The file '.$local_file.' does not exist!');
}

php技術php實現下載限制速度示例分享,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 扎鲁特旗| 广宁县| 布尔津县| 石门县| 沽源县| 天长市| 怀柔区| 龙胜| 涿鹿县| 且末县| 凤山县| 凤台县| 海林市| 洪湖市| 西安市| 凭祥市| 永清县| 垣曲县| 雷山县| 陵川县| 九寨沟县| 津南区| 靖宇县| 天长市| 宁夏| 林甸县| 三江| 康平县| 沽源县| 曲靖市| 陈巴尔虎旗| 乌拉特中旗| 蒙山县| 临江市| 中西区| 建始县| 台北县| 五寨县| 中超| 兴化市| 永泰县|