Created
June 30, 2015 04:04
-
-
Save softsolution/5a0c0ca6e361cbacf25f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: text/csv"); | |
header("Content-Disposition: attachment; filename=file.csv"); | |
header("Pragma: no-cache"); | |
header("Expires: 0"); | |
$array = array( // данные которые мы будем выводить в csv файл | |
0 => array('Nikolay','nikolay@email.ru'), | |
1 => array('Maria', 'maria@email.ru') | |
); | |
$out = fopen('php://output', 'w'); | |
foreach($array as $item) | |
{ | |
fputcsv($out, array($item[0],$item[1])); | |
} | |
fclose($out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment