note 74119 added to function.fputcsv
| From: | bl at mindbench dot nl | Date: | Mon, 26 Mar 2007 08:55:11 +0000 |
| Subject: | note 74119 added to function.fputcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124805@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 194.123.221.29
----
Manual Page -- http://www.php.net/manual/en/function.fputcsv.php
Edit -- https://master.php.net/note/edit/74119
Del: integrated -- https://master.php.net/note/delete/74119/integrated
Del: useless -- https://master.php.net/note/delete/74119/useless
Del: bad code -- https://master.php.net/note/delete/74119/bad+code
Del: spam -- https://master.php.net/note/delete/74119/spam
Del: non-english -- https://master.php.net/note/delete/74119/non-english
Del: in docs -- https://master.php.net/note/delete/74119/in+docs
Del: other reasons-- https://master.php.net/note/delete/74119
Reject -- https://master.php.net/note/reject/74119
Search -- https://master.php.net/manage/user-notes.php