求解关于PHP导出EXCEL的一个疑义
求解关于PHP导出EXCEL的一个疑问
我所知道的两种办法是
1、用户点击导出的时候,PHP发送EXCEL类型文件头,输出内容,这样用户就可以保存到本地。但这个办法目前满足不了我的需求,因为当用户导出的数据过大时,因为PHP内存的限制而失败。。所以考虑到使用分页处理,方法2
2、使用分页访问数据,创建文件,逐条插入,但这种方法的话,文件会保存在服务器里。。
这只是我初步认识到的,不知道有什么方法可以解决,望大侠们不要见笑。。求指教。。
------解决方案--------------------
你导出的文件有多大。会超出内存限制。把内存限制改大点呢?
试试 PHPEXCEL 这个类看行不行。
------解决方案--------------------
文件会有多大呀!可以在单页面设置一下内存限制呀!再者你可以把文件中不用的变量内存给释放掉,如果一个页面请求要处理20个sql查询,每个sql查询返回10个sql结果,如果一条row有10K, 那么这个页面到处理结束时就要增加到 10K*10*20=2M的数组分配,这还不算有时候我们需要最数组进行复制,所以优化一下代码。内存应该是足够了!
------解决方案--------------------
别一下把execl读到内存里, 读一点发一点。
------解决方案--------------------
readfile,试一下好不好用。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

This chapter deals with the information about the authentication process available in CakePHP.
