How to create, write to and delete temporary file in PHP

1 Answer

0 votes
// string tempnam(string $dir, string $prefix)

$tmpfilename = tempnam("/tmp", "qq");

$handle = fopen($tmpfilename, "w");
fwrite($handle, "write something to tempfile");
fclose($handle);

unlink($tmpfilename);


 
/*
run:
     

     
*/

 



answered Jul 21, 2016 by avibootz
...