Let's say I have a database.... is there a way I can export what I have from the database to a CSV file (and text file [if possible]) via PHP?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Just for the record, concatenation is waaaaaay faster (I mean it) than
fputcsv
or evenimplode
; And the file size is smaller:This is the conclusion of the optimization of several reports, from ten to thousands rows. The three examples worked fine under 1000 rows, but fails when the data was bigger.
Just like @Dampes8N said:
Hope this helps.
Works with over 100 lines, if you specify the size of the file in the headers simple call the get() method in your own class
I personally use this function to create CSV content from any array.
Then you can make your user download that file using something like:
Usage example:
I recommend parsecsv-for-php to get around a number any issues with nested newlines and quotes.
You can export the date using this command.
First you must load the data from the mysql server in to a array