解决PHP下载文件时因时文件太大而报404错误
2024-10-17 00:40:02
set_time_limit(0);
ini_set('memory_limit', '512M');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
ob_end_clean();
readfile($file);
主要注意前面2个设置(根据情况自己设置内存大小)和 ob_end_clean();函数的调用。
最新文章
- [转]HttpModule的认识
- Web3DGame之路,Babylonjs 和TypeScript学习笔记(二)
- C/C++函数调用的几种方式及函数名修饰规则以及c++为什么不允许重载仅返回类型不同的函数
- Noi2011 阿狸的打字机
- windows服务(installutil.exe)报错。异常来自 HRESULT:0x80131515
- java 15 -7 ListIterator 的特有方法
- 【WEB API项目实战干货系列】- API登录与身份验证(三)
- LightOJ1158 Anagram Division(状压DP)
- C++之STL之string
- Excel 操作类
- Visual Studio的常用快捷键
- Retrofit2.0 设置 连接超时
- Binary Tree Path Sum
- Fiddler: 如何抓取HTTPS协议的网页
- 3D点云数据分析:pointNet++论文分析及阅读笔记
- SAP 费用
- 用PLSQL Developer 查看连接因子 tnsnames.ora
- strus2 struts.xml详解
- LintCode 412: Candy
- python学习笔记011——检查变量类型type()