<a href="http://xxx.com/2018-06-13/10959240_2018-06-13_18-38-53.mp4">查看</a>
原本的意图是想点击后直接进行视频下载,但是实际上浏览器直接进行了播放,解决方案:
nginx服务器配置:
location ~ \.mp4{
#如果请求地址中有请求参数?filename=,那么就视为下载操作
if ( $query_string ~* "filename=" ) {
add_header Content-Disposition attachment;
}
root /home/ftpuser/www/mp4/;#文件位置
}
路径下面加上参数即可
<a href="http://xxx.com/2018-06-13/10959240_2018-06-13_18-38-53.mp4?filename=xxx">查看</a>
这时点击后即可不进入播放页面,而是直接进行下载。