php 文件流输出

来源:互联网 发布:c语言数据类型 编辑:程序博客网 时间:2024/04/26 07:36
public function download(){    $fileName = trim($_REQUEST['fileName']);    $outFileName = "aaa.excel";    $path = './data/uploads/';    $outFileName = iconv("UTF-8", "GB2312", $outFileName);//解决文件名乱码    // 设置下载头信息    header ( "Content-Type: application/vnd.ms-excel" );    header ( "Content-Disposition: attachment; filename=".$outFileName );    // 文件流输出到浏览器    readfile ($path . $fileName);    // 删除文件    @unlink($path . $fileName);}

window.location.href = url;
原创粉丝点击