note 120062 added to function.tmpfile

From: Date: Wed, 19 Oct 2016 15:19:19 +0000
Subject: note 120062 added to function.tmpfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-206925@lists.php.net to get a copy of this message
Since this function may not be working in some environments, here is a simple workaround: function temporaryFile($name, $content) { $file = DIRECTORY_SEPARATOR . trim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($name, DIRECTORY_SEPARATOR); file_put_contents($file, $content); register_shutdown_function(function() use($file) { unlink($file); }); return $file; } ---- Server IP: 72.52.91.14 Probable Submitter: 84.74.172.229 ---- Manual Page -- http://php.net/manual/en/function.tmpfile.php Edit -- https://master.php.net/note/edit/120062 Del: integrated -- https://master.php.net/note/delete/120062/integrated Del: useless -- https://master.php.net/note/delete/120062/useless Del: bad code -- https://master.php.net/note/delete/120062/bad+code Del: spam -- https://master.php.net/note/delete/120062/spam Del: non-english -- https://master.php.net/note/delete/120062/non-english Del: in docs -- https://master.php.net/note/delete/120062/in+docs Del: other reasons-- https://master.php.net/note/delete/120062 Reject -- https://master.php.net/note/reject/120062 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206925) next »