protected function download($data, $fileName = null)
    {
        if ($fileName === null) {
            $fileName = time();
        }

        while (ob_get_level() > 0) {
            ob_end_flush();
        }

        header('Content-Type: ' . $this->contentType);
        header('Content-Disposition: attachment; fileName="' . $fileName .'"');
        header("Content-Length: " . strlen($data));

        echo $data;
    }
protected function download($data, $fileName = null)
    {
        if ($fileName === null) {
            $fileName = time();
        }

        while (ob_get_level() > 0) {
            ob_end_flush();
        }

        header('Content-Type: ' . $this->contentType);
        header('Content-Disposition: attachment; fileName="' . $fileName .'"');
        header("Content-Length: " . strlen($data));

        echo $data;
    }
protected function download ( $ data , $ fileName = null ) { if ( $ fileName === null ) { $ fileName = time ( ) ; } while ( ob_get_level ( ) > 0 ) { ob_end_flush ( ) ; } header ( 'Content-Type: ' . $ this -> contentType ) ; header ( 'Content-Disposition: attachment; fileName="' . $ fileName . '"' ) ; header ( "Content-Length: " . strlen ( $ data ) ) ; echo $ data ; }
Send exported data to end user
@param string $data Data to be exported
@param string|null $fileName
@return mixed
Send exported data to end user