PHP头条
热点:

php上载文件


php下载文件
php下载文件遇到的两种方式
第一种
$file = 'data/upload/文件.exe';
@header("Location:$file");exit;
此种方式不可取。因为没有告诉浏览器下载的文件的类型,如果浏览器的mime类型中没有,那么就会打开这个链接。
第二种
$filename   =   './download/文件名.exe ';
$filesize   =   filesize($filename);
header( "Content-Type:   application/force-download ");
header( "Content-Disposition:   attachment;   filename= ".basename($filename));
header( "Content-Length:   ".$filesize);
$data   =   file_get_contents($filename);
echo   $data;
或者是readfile($filename);

www.phpzy.comtrue/phprm/31469.htmlTechArticlephp上载文件 php下载文件 php下载文件遇到的两种方式 第一种 $file = 'data/upload/文件.exe'; @header("Location:$file");exit; 此种方式不可取。因为没有告诉浏览器下载的文件的类型,如果浏览器的...

相关文章

PHP之友评论

今天推荐