private function buildCsv()
    {

        if ($this->display_elements['excel'] === true) {
            header('Content-Type: application/vnd.ms-excel');
        } else {
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
        }
        if ($this->display_elements["name"] != null) {
            header('Content-Disposition: attachment; filename='.$this->display_elements["name"].'.csv');
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
        }

        $u = 0;
        echo (chr(0xEF) . chr(0xBB) . chr(0xBF));
        foreach ($this->display_elements['csv'] as $one) {
            if ($this->display_elements['keys_show'] && $u === 0) {
                echo implode(";", (array_keys($one))) . "\n";
            }
            if (is_array($one)) {
                echo (implode(";", $one)) . "\n";
            } else {
                echo ($one)."\n";
            }
            $u++;
        }
    }
private function buildCsv()
    {

        if ($this->display_elements['excel'] === true) {
            header('Content-Type: application/vnd.ms-excel');
        } else {
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
        }
        if ($this->display_elements["name"] != null) {
            header('Content-Disposition: attachment; filename='.$this->display_elements["name"].'.csv');
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
        }

        $u = 0;
        echo (chr(0xEF) . chr(0xBB) . chr(0xBF));
        foreach ($this->display_elements['csv'] as $one) {
            if ($this->display_elements['keys_show'] && $u === 0) {
                echo implode(";", (array_keys($one))) . "\n";
            }
            if (is_array($one)) {
                echo (implode(";", $one)) . "\n";
            } else {
                echo ($one)."\n";
            }
            $u++;
        }
    }
private function buildCsv ( ) { if ( $ this -> display_elements [ 'excel' ] === true ) { header ( 'Content-Type: application/vnd.ms-excel' ) ; } else { header ( 'Content-Transfer-Encoding: binary' ) ; header ( 'Expires: 0' ) ; header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ) ; header ( 'Pragma: public' ) ; } if ( $ this -> display_elements [ "name" ] != null ) { header ( 'Content-Disposition: attachment; filename=' . $ this -> display_elements [ "name" ] . '.csv' ) ; header ( 'Content-Transfer-Encoding: binary' ) ; header ( 'Expires: 0' ) ; header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ) ; header ( 'Pragma: public' ) ; } $ u = 0 ; echo ( chr ( 0xEF ) . chr ( 0xBB ) . chr ( 0xBF ) ) ; foreach ( $ this -> display_elements [ 'csv' ] as $ one ) { if ( $ this -> display_elements [ 'keys_show' ] && $ u === 0 ) { echo implode ( ";" , ( array_keys ( $ one ) ) ) . "\n" ; } if ( is_array ( $ one ) ) { echo ( implode ( ";" , $ one ) ) . "\n" ; } else { echo ( $ one ) . "\n" ; } $ u ++ ; } }
Build a CSV
Build a CSV