php下载文件添加header响应头

header( 'Content-type:application/octet-stream' );
header( 'Content-Disposition:attachment;filename="' . basename ( $file ). '"' );
header( 'Content-Length:' . filesize ( $file ));
readfile( $file );

猜你喜欢

转载自www.cnblogs.com/jielin/p/10203140.html