note 106624 added to function.tmpfile
| From: | kexianbin at diyism dot com | Date: | Wed, 23 Nov 2011 02:55:19 +0000 |
| Subject: | note 106624 added to function.tmpfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184629@lists.php.net to get a copy of this message | ||
A clean method to use tempory file:
<?
$tmp_meta=stream_get_meta_data(tmpfile());
file_put_contents($tmp_meta['uri'], 'hello');
echo file_get_contents($tmp_meta['uri']);
?>
without need to fclose the tmp file, it will be deleted while the php ends.
----
Server IP: 69.147.83.197
Probable Submitter: 216.131.79.221
----
Manual Page -- http://www.php.net/manual/en/function.tmpfile.php
Edit -- https://master.php.net/note/edit/106624
Del: integrated -- https://master.php.net/note/delete/106624/integrated
Del: useless -- https://master.php.net/note/delete/106624/useless
Del: bad code -- https://master.php.net/note/delete/106624/bad+code
Del: spam -- https://master.php.net/note/delete/106624/spam
Del: non-english -- https://master.php.net/note/delete/106624/non-english
Del: in docs -- https://master.php.net/note/delete/106624/in+docs
Del: other reasons-- https://master.php.net/note/delete/106624
Reject -- https://master.php.net/note/reject/106624
Search -- https://master.php.net/manage/user-notes.php