色尼玛亚洲综合影院,亚洲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實現下載限制速度示例分享,轉載需保留來源!

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

主站蜘蛛池模板: 陆良县| 华宁县| 沧源| 孟州市| 扬州市| 应用必备| 海晏县| 宾阳县| 广宗县| 五寨县| 银川市| 黄浦区| 密云县| 虎林市| 孝感市| 通化县| 五常市| 龙海市| 成安县| 运城市| 卢龙县| 蓬安县| 含山县| 苏尼特右旗| 汤阴县| 娄底市| 榆社县| 铜陵市| 湘乡市| 修文县| 马关县| 乌鲁木齐市| 容城县| 太仆寺旗| 德化县| 达尔| 远安县| 朔州市| 德令哈市| 宜黄县| 隆尧县|