标签:binary exce content nsf control must 加载 ida time
header信息填好就行,直接echo会在浏览器输出乱码
<?php set_time_limit(0); ini_set(‘memory_limit‘, ‘-1‘); try{ // 上传时间 $filePath = ‘worl.xlsx‘; header(‘Content-Description: attachment; File Transfer‘); header(‘Content-Disposition: attachment; filename=test.xlsx‘); header(‘Content-Transfer-Encoding: binary‘); header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0‘); header(‘Expires: 0‘); // 如果文件非常大的情况可以使用ob缓冲区 - 先加载到缓冲区再输出 echo file_get_contents($filePath); } catch (\Exception $e) { echo 0; }
标签:binary exce content nsf control must 加载 ida time
原文地址:https://www.cnblogs.com/xuweiqiang/p/11104054.html