mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Re-added the code to grap object-level filename in output()
Follow-up on pull request #88: No breaking compatibality with older parsecsv versions. If no output to browser is desired, set $output_filename to null, or use unparse() function.
This commit is contained in:
@@ -448,14 +448,20 @@ class parseCSV {
|
|||||||
* Generate a CSV based string for output.
|
* Generate a CSV based string for output.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param [string] $filename If specified, headers and data will be output directly to browser as a downloadable file
|
* @param string|null $filename If a filename is specified here or in the
|
||||||
* @param [array] $data 2D array with data
|
* object, headers and data will be output
|
||||||
* @param [array] $fields Field names
|
* directly to browser as a downloadable
|
||||||
* @param [type] $delimiter delimiter used to separate data
|
* file.
|
||||||
|
* @param array[] $data 2D array with data
|
||||||
|
* @param array $fields Field names
|
||||||
|
* @param string|null $delimiter character used to separate data
|
||||||
*
|
*
|
||||||
* @return [string] the resulting CSV string
|
* @return string The resulting CSV 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)) {
|
||||||
|
$filename = $this->output_filename;
|
||||||
|
}
|
||||||
|
|
||||||
if ($delimiter === null) {
|
if ($delimiter === null) {
|
||||||
$delimiter = $this->output_delimiter;
|
$delimiter = $this->output_delimiter;
|
||||||
|
|||||||
Reference in New Issue
Block a user