laravel big data export cannot perform how to optimize
laravel big data export cannot perform how to optimize
cannot be executed? The code has bug?
big data when foreach plus reference
if exported to csv format, there will be no problem, just open a file, stream write data on it.
but if you are using phpexcel, each cell is a php object. Even if caching is enabled, if there is too much data, an error will be reported that there is not enough memory.
data is very large
you ask others to write a long text to make it clear, and finished may not solve your problem, what if your code has bug?
paste your code in segments and explain. Then take a screenshot of the error report and put it in the question first.
just as it happens, sg pushed me an article this morning.
PHP generates and downloads EXCEL files with a large amount of data in real time
which may help you a lot
this problem only uses a solution, which does not consider the efficiency of your sql and code execution. Csv format is not considered here, because many operators or other people who need data need it. Originally, there are nearly 70 fields in my export, so you know that when exporting a large amount of data, there will be two obvious problems: script execution time is long, memory consumption is much longer, it is very easy to 504 (not discussing nginx php-cgi configuration here), and it will take up a lot of cpu time cpu occupancy soars, another possible problem is that when there are multiple exports in parallel, it will eat up a lot of memory, affecting the online business. So you can use paging export, and then this paging can still process the output on the server. Another better solution is that the server outputs JSON client to export excel, paging and browser export can solve this problem very well. Recommend a js export plug-in sheetJs github https://github.com/SheetJS/js.
you can use yield;
it can be said that any amount of data can be executed, and there are many introductions in the community, which you can take a look at.
fetch the data by paging and append it to the file.
traverse the request interface to write to the cache and then export the excel.
No error is reported, but the data is very large. Finally, it directly fails to reflect
directly splicing the data in the database
post table is the article table, the primary key is id tag table is the tag table, the primary key is id post_tag is the intermediate mapping table, and the field is post_id,tag_id now I want to select tag 1 to find out that all the tags and article...
I judge in the render method of Handler that FatalErrorException returns an array when an exception occurs. there are other error messages on the returned array, but should you only return the array when catching an exception? how to solve this sit...
laravel Package development, how to deal with the many-to-many relationship between Model in a package and Model outside the package? for example: for example, we are going to write an awesome Article Package,. This package mainly provides functions ...
I think belongsTo or hasMany is usually written in model. What s the use of writing this? The following is the code in someone else s Car model. I think when he used it in the controller, he wrote $car = Car::find ($id) . It doesn t seem to be conve...
suppose: there are two projects, Project An and Project B, and I want Project An and Project B to share the same framework. Is there a way to achieve ...
https: devforgalaxy.github.i. I am here to see the first step alone is off . sudo php -r "readfile( https: getcomposer.org installer );" > composer-setup.php -bash: composer-setup.php: Permission denied ...
what is the difference between the request parameters obtained by Input:all () in the laravel framework and the native $REQUEST acquisition parameters in php? $input = Input:all (); $input = { "P_UserId ": "10 ", "P_OrderId ": "2302722018033018420...
1. Do you need a framework? the framework loads too many files by default, which hinders performance . two The framework comes with interface verification (to prevent arbitrary calls), version management (APP version upgrade is fast), etc., if there is ...
Laravel version5.5, uses php artisan serve to start the metropolis server to confirm that the route has been registered, the result obtained by using php artisan route:list is as follows visit batches and return 200 correctly visit b...
I added withCredentials to my front-end request, even though I deployed the front and back ends separately. assume that the front end is deployed at web.xxx.com and that the back end is deployed at service.xxx.com I define all api as web, so ...
by editing a template file such as file.xls, there is a lot of data that needs to be filled in by php, and then other text or tables may have styles, such as red words, large words, table borders, etc. (I have tried to export csv, but feel that this for...
download : ask the boss to answer it! ...
$validator = Validator::make($request->all(), [ id => required|integer title => required|unique:posts|max:255 , body => required , ]); The requirement is like ...
just started to use the laravel framework development, or rookies ~ a lot of do not quite understand, at present to do a function, customized a form verification class file ~ ~ for example, I am now a member module, my member controller can have many way...
how do I use a laravel package such as l5-repository ( https: packagist.org package.) when developing a laravel package myself? We can use composer require to come in, but how do we register ServiceProvider in the package? ...
I use js to assemble the data and then ajax to transmit it to the background. $request- > file () always cannot receive the file, and the file field passed by is always converted into a string [object File] how to solve foreground ajax code onAjax(f...
Mini Program post requests that an array of objects is passed in the data. What happened to the [object Object] printed out by the backend? ...
Why do you have to insert a new piece of empty data every time you execute this statement one more empty data at a time. I don t know how to ask for advice ...
the configuration of Redis was not found in official document . How should I configure it? add: configure requirepass in the configuration file of Redis, but this Redis is on Homestead, not locally. Because of my unfamiliarity with Homestead, I don ...
the project is very fast locally. After it is deployed to the server, there will be problems with online access. Sometimes it will come out after visiting 0.1s, and sometimes it will show "connecting " all the time. It took more than ten seconds to co...