mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
output
This commit is contained in:
@@ -460,17 +460,17 @@ class parseCSV {
|
|||||||
* @return [string]
|
* @return [string]
|
||||||
*/
|
*/
|
||||||
public function output ($filename = null, $data = array(), $fields = array(), $delimiter = null) {
|
public function output ($filename = null, $data = array(), $fields = array(), $delimiter = null) {
|
||||||
if ( empty($filename) ) {
|
if (empty($filename)) {
|
||||||
$filename = $this->output_filename;
|
$filename = $this->output_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $delimiter === null ) {
|
if ($delimiter === null) {
|
||||||
$delimiter = $this->output_delimiter;
|
$delimiter = $this->output_delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->unparse($data, $fields, null, null, $delimiter);
|
$data = $this->unparse($data, $fields, null, null, $delimiter);
|
||||||
|
|
||||||
if ( $filename !== null ) {
|
if (!is_null($filename)) {
|
||||||
header('Content-type: application/csv');
|
header('Content-type: application/csv');
|
||||||
header('Content-Length: '.strlen($data));
|
header('Content-Length: '.strlen($data));
|
||||||
header('Cache-Control: no-cache, must-revalidate');
|
header('Cache-Control: no-cache, must-revalidate');
|
||||||
|
|||||||
Reference in New Issue
Block a user