Course Recommendations:
PHP tmpfile() function
Definition and Usage
The tmpfile() function creates a temporary file with a unique filename in read-write (w+) mode.
The file will be automatically deleted after closing (using fclose()) or when the script ends.
Syntax
tmpfile()
Hints and commentsHint: See alsotempnam()
.
Example <?php $temp = tmpfile(); fwrite($temp, "Testing, testing."); //Go back to the beginning of the file //Read 1k from file echo fread($temp,1024); //Delete file fclose($temp); ?>
Output:
Testing, testing.