-
-
Save aleckyann/67b2f1f08d6e34c35e113451e583d452 to your computer and use it in GitHub Desktop.
gerando .csv
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
//EXEMPLO: | |
// QUERO PEGAR EQUIPAMENTOS DA TABELA EQUIPAMENTOS E GERA O .CSV : | |
function writeCSV($nome_do_arquivo, $array_de_arrays, $array_de_indices = array()) { | |
$arquivo = fopen(FCPATH.$nome_do_arquivo, 'w'); | |
array_unshift($array_de_arrays, $array_de_indices); | |
foreach ($array_de_arrays as $array) { | |
fputcsv($arquivo, $array); | |
} | |
fclose($arquivo); | |
} | |
writeCSV(base_url('equipamentos.csv'), $this->get('equipamentos')->result_array()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment