/** * @param $file 视频路径 * @param $showname 显示下载的视频名称 * @return int|string */ public function download_file($file,$showname){ if(is_file($file)){ $length = filesize($file); header("Content-Description: File Transfer"); header('Content-type: video/mp4'); header('Content-Length:' . $length); if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { //for IE header('Content-Disposition: attachment; filename="' . rawurlencode($showname.'.mp4') . '"'); } else { header('Content-Disposition: attachment; filename="' . $showname.'.mp4' . '"'); } return readfile($file); } else { return('文件已被删除!'); } }
thinkphp下载MP4视频
猜你喜欢
转载自blog.csdn.net/qq_37995146/article/details/78348991
今日推荐
周排行