Export csv to zend framework

I know how to export csv file to php. Now I want to complete this task in zendframe work.

1 I want to know if there is built-in functionality that zend provides for these purposes, or do we need to write the same code that we use in simple php?

2 If I need to use the same code, then where should I put it in a model or controller?

3 I have a view where the user can select the start date, last date and user and then press enter. Based on this choice I want to exprot csv file.

Someone tell me how to complete this task.

+3
source share
3 answers

To organize your scores

  • Zend Framework , CSV.

  • (.. 3) . , CSV, , SendFile, CSV .

  • . CSV, ( 2), .

CSV fputcsv, .

+8

Action Zend Framework - . , . http://blog.abmeier.de/zend-csv-action-helper

+6

Based on regilero's answer for this question , I came up with a Zend solution. Just use the full query in the database itself:

$result = $this->_db->query(
     'SELECT * FROM `table_xy`'
    .'INTO OUTFILE \'tmp/outputfile.csv\''
    .'FIELDS TERMINATED BY \';\''
    .'ENCLOSED BY \'"\''
    .'LINES TERMINATED BY \'\\n\''
);

Remember to configure the necessary privileges for this user.

0
source

All Articles