Difference between #227 and #228 of
Yii v2 snippet guide

Revision #228 has been created by rackycz on Aug 21, 2020, 6:46:25 PM with the memo:

Export to CSV
« previous (#227) next (#229) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
// Double quotes must be used around \n !
$csv = implode("\n", $rows);

$currentDate = date('Y-m-d_H-i-s');

return \Yii::$app->response->sendContentAsFile($csv, '
invoiceusers_' . $currentDate . '.csv', [
'mimeType' => 'application/csv',
'inline' => false
[...]
// These 2 rows already existed
$searchModel = new
InvoiceUserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams)

if ($exportToCsv) {
$this->exportDataProviderToCsv($dataProvider);
return;
[...]
7 0
4 followers
Viewed: 274 988 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history