php header 强制浏览器下载文件
作者:admin 发布于:2015-1-5 12:07 Monday 分类:PHP
05Jan
$filename = "文件 名.txt"; $content=file_get_contents('/uploads/sdfsaf.txt');//将文件读入字符串 $length=strlen($content);//取得字符串长度,即文件大小,单位是字节 $encoded_filename = rawurlencode($filename);//采用rawurlencode避免空格被替换为+ $ua = $_SERVER["HTTP_USER_AGENT"];//获取用户浏览器UA信息 header('Content-Type: application/octet-stream');//告诉浏览器输出内容类型,必须 header('Content-...