文件下载 header 设置
$path = "文件路径";
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="'. basename( $path) .'"');
header("Content-Length: ". filesize( $path));
readfile( $path);
解决跨域问题
header("Content-type: application/json");
header("Access-Control-Allow-Origin: *" );
header("Access-Control-Allow-Methods: GET, OPTIONS, POST");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding, X-Requested-With, Origin");