note 111721 added to function.tmpfile

From: Date: Wed, 20 Mar 2013 17:08:57 +0000
Subject: note 111721 added to function.tmpfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-194137@lists.php.net to get a copy of this message
If you simply need a random filename in the tmp directory (so it will be auto-removed later by the system), you can do this. <?php $tmpDest = tempnam(sys_get_temp_dir(), 'prefix') . '.txt'; file_put_contents($tmpDest, 'some text'); ?> It will be a file name, not a file handle, so you don't have to worry about closing it. ---- Server IP: 69.147.83.199 Probable Submitter: 208.101.220.213 ---- Manual Page -- http://php.net/manual/en/function.tmpfile.php Edit -- https://master.php.net/note/edit/111721 Del: integrated -- https://master.php.net/note/delete/111721/integrated Del: useless -- https://master.php.net/note/delete/111721/useless Del: bad code -- https://master.php.net/note/delete/111721/bad+code Del: spam -- https://master.php.net/note/delete/111721/spam Del: non-english -- https://master.php.net/note/delete/111721/non-english Del: in docs -- https://master.php.net/note/delete/111721/in+docs Del: other reasons-- https://master.php.net/note/delete/111721 Reject -- https://master.php.net/note/reject/111721 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194137) next »