note 74119 deleted from function.fputcsv by bobby
| From: | bobby@php.net | Date: | Mon, 26 Mar 2007 14:27:14 +0000 |
| Subject: | note 74119 deleted from function.fputcsv by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124810@lists.php.net to get a copy of this message | ||
Note Submitter: bl at mindbench dot nl
----
If you need to save the output to a variable (e.g. for use within a framework) you can write to a
temporary memory-wrapper and retrieve it's contents:
<?php
// output up to 5MB is kept in memory, if it becomes bigger it will automatically be written to a
temporary file
$csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+');
fputcsv($csv, array('blah','blah'));
rewind($csv);
// put it all in a variable
$output = stream_get_contents($csv);
?>