Begin:
Copy CodeThe code is as follows:
Public Function Executeregistrantstocsv () {
$id = $this->getrequestparameter (' id ');
$c = new Criteria ();
$c->add (registrantpeer::event_id, $id);
$c->add (Registrantpeer::status, 1);
$this->aobjreg = registrantpeer::d oselect ($c);
$this->forward404unless ($this->aobjreg);
$this->setlayout (' csv ');
$this->getresponse ()->clearhttpheaders ();
$this->getresponse ()->sethttpheader (' Content-type ', ' application/vnd.ms-excel ');
$this->getresponse ()->sethttpheader (' content-disposition ', ' attachment; filename=registrants_report_event_ ' . $id. '. csv ');
}
In the template registrantstocsvsuccess.php:
Copy CodeThe code is as follows:
Title,name,email,phone,organisation,state,city,country,login date,ipaddress
GetTitle (), GetName (), Getemail (), Getphone (), Getorganisation (), GetState (), Getcity (), Getcountry (), Getlogindate (), Getipaddress (),
In the templates/csv.php:
Getraw (' sf_content ')?>
from:http://blog.baddog.net.au/sonius/steve-sonius/how-to-export-data-as-a-csv-file-in-symfony/
If it doesn ' t work, try This:http://blog.baddog.net.au/sonius/steve-sonius/ how-to-export-data-as-an-xls-or-csv-file-from-the-admin-generator-in-symfony-1-4/
http://www.bkjia.com/PHPjc/324389.html www.bkjia.com true http://www.bkjia.com/PHPjc/324389.html techarticle Start: Copy code as follows: Public function executeregistrantstocsv () {$id = $this-getrequestparameter (' id '); $c = new Criteria (); $c-add (registrantpeer::event_id, $id); $c ...