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