php create temporary file

Solutions on MaxInterview for php create temporary file by the best coders in the world

showing results for - "php create temporary file"
Kiley
19 Apr 2016
1// Works on Native Server
2// $tmp = tmpfile();
3// $newfilename = 'newfile.txt';
4// fwrite($tmp, "This is a sample string as a content.");
5// fseek($tmp, 0);
6
7// Works on Google App Engine
8$dir = sys_get_temp_dir();
9$tmp = tempnam($dir, "foo");
10file_put_contents($tmp, "hello");
11//$f = fopen($tmp, "a");
12//fwrite($f, " world");
13//fclose($f);
14//echo file_get_contents($tmp);