四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

php實(shí)現(xiàn)下載限制速度示例分享

復(fù)制代碼 代碼如下:
// 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技術(shù)php實(shí)現(xiàn)下載限制速度示例分享,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 小猫叫声吸引猫mp3| 张柏芝演的电视剧| 操蛋视频| 寡妇激情| 色女孩视频| 美姐妹肉奴隶赤坂丽| 林柒予| 文王一支笔的功效与作用| 蒋锐| 那些女人电视剧免费观看全集剧情| 爷爷的爷爷怎么称呼| 秀人网门户官网| 包头电视台| dakota johnson| russian institute| 张天启| 张志忠演员| 二年级上册道法教学计划| 鲍鱼视频在线观看| 滕子萱| 浙江卫视节目在线观看直播| 二胡独奏我的祖国| 马德哈万| 海洋之歌电影| 疯狗强尼电影完整版在线观看| 意大利∴多情少妇| 台州林毅| 少年派1主演名单| 月光奏鸣曲第三乐章钢琴谱| 爽文视频| 比基尼诱惑| 起底员工上满8小时被扣工资的公司| 风间由美电影影片| 米奇888| 周末父母42集剧情介绍| 宋晓飞| 六年级下册语文文言文二则| 缉私群英 电视剧| 家书1000字| 骨骺线闭合增高9厘米| 安娜罗曼史|