当前位置 : 主页 > 网络编程 > PHP >

php 打开浏览器下载对话框

来源:互联网 收集:自由互联 发布时间:2021-06-30
$library_path = dirname(dirname(dirname(dirname(__FILE__))))."/library/file/"; $file = $library_path."ip_library_ok.txt"; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Dispos
 
$library_path = dirname(dirname(dirname(dirname(__FILE__))))."/library/file/";
        $file = $library_path."ip_library_ok.txt";
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename='.basename($file));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        ob_clean();
        flush();
        readfile($file);

网友评论