thinkphp下载MP4视频
2022-11-24 11:10:29
178
{{single.collect_count}}
/** * @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 IEheader('Content-Disposition: attachment; filename="' . rawurlencode($showname.'.mp4') . '"');} else {header('Content-Disposition: attachment; filename="' . $showname.'.mp4' . '"');}return readfile($file);} else {return('文件已被删除!');}}


回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}