| Server IP : 162.214.74.102 / Your IP : 216.73.217.114 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/leo/application/plugins/module_imobles/helpers/ |
Upload File : |
<?php
class CSVHelper{
public function writeCSV($filename, $headings, $data) {
$newTab = ",";
$newLine = "\n";
$fputcsv = count($headings) ? '"' . implode('"' . $newTab . '"', $headings) . '"' . $newLine : '';
// Loop over the * to export
if (!empty($data)) {
foreach ($data as $item) {
$fputcsv .= '"' . implode('"' . $newTab . '"', $item) . '"' . $newLine;
}
}
//Convert CSV to UTF-16
// $encoded_csv = mb_convert_encoding($fputcsv, 'UTF-16LE', 'UTF-8');
// Output CSV-specific headers
header('Set-Cookie: fileDownload=true; path=/'); //This cookie is needed in order to trigger the success window.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$filename.csv\";");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . strlen($fputcsv));
echo $fputcsv; //php array convert to csv/excel
}
}