PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

php下载服务器上的资料

原创
2016-06-13 11:33:43 694浏览

php下载服务器上的文件

$file_xls=$path; // 文件的保存路径

$example_name=basename($file_xls); //获取文件名


header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.mb_convert_encoding($example_name,"gb2312","utf-8")); //转换文件名的编码
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_xls));
ob_clean();
flush();
readfile($file_xls);

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。