您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

谁能解释下这个下载

2024/5/5 15:32:14发布21次查看
if(is_file($file)) {
            header(content-type: application/force-download);
            header(content-disposition: attachment; filename=.basename($file));
            readfile($file);
            exit;
        }else{
            echo 文件不存在!;
            exit;
        }
application/force-download是什么
content-disposition: attachment是什么  filename是什么 readfile是什么
回复讨论(解决方案) application/force-download 是一种 mime 类型,用于告知接收方:这是一个文件下载
content-disposition 是 mime 协议的扩展
content-disposition: attachment 告知接收方:后面的 filename 属性是参考文件名
通常浏览器会弹出一个下载对话框,并显示文件名
readfile 是 php 函数
从函数名上就可看出他的功能 读(read)文件(file)
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product