src/SMB/Arrayto/Traits/Xsv/Creatable.php
protected function createOutputContents(
        array $header,
        $delimiter = ',',
        $enclosure = '"',
        $toConvert = true
    )
    {
        $fp = fopen("php://temp", 'r+b');

        // header
        if ($header) {
            fputcsv($fp, $header, $delimiter, $enclosure);
        }

        foreach ($this->rows as $row) {
            fputcsv($fp, $row, $delimiter, $enclosure);
        }

        rewind($fp);

        $buffer = stream_get_contents($fp);

        if ($toConvert === false) {
            fclose($fp);
            return $buffer;
        }

        $ret = $this->convert($buffer);

        fclose($fp);

        return $ret;
    }
protected function createOutputContents(
        array $header,
        $delimiter = ',',
        $enclosure = '"',
        $toConvert = true
    )
    {
        $fp = fopen("php://temp", 'r+b');

        // header
        if ($header) {
            fputcsv($fp, $header, $delimiter, $enclosure);
        }

        foreach ($this->rows as $row) {
            fputcsv($fp, $row, $delimiter, $enclosure);
        }

        rewind($fp);

        $buffer = stream_get_contents($fp);

        if ($toConvert === false) {
            fclose($fp);
            return $buffer;
        }

        $ret = $this->convert($buffer);

        fclose($fp);

        return $ret;
    }
protected function createOutputContents ( array $ header , $ delimiter = ',' , $ enclosure = '"' , $ toConvert = true ) { $ fp = fopen ( "php://temp" , 'r+b' ) ; // header if ( $ header ) { fputcsv ( $ fp , $ header , $ delimiter , $ enclosure ) ; } foreach ( $ this -> rows as $ row ) { fputcsv ( $ fp , $ row , $ delimiter , $ enclosure ) ; } rewind ( $ fp ) ; $ buffer = stream_get_contents ( $ fp ) ; if ( $ toConvert === false ) { fclose ( $ fp ) ; return $ buffer ; } $ ret = $ this -> convert ( $ buffer ) ; fclose ( $ fp ) ; return $ ret ; }
Create an output content
@param array $header
@param string $delimiter
@param string $enclosure
@param boolean $toConvert true : LF => CRLF, UTF-8 => SJIS-win, false : LF, UTF-8
@return string
Create an output content