tmpfile
Create a temporary file
tmpfile()
function creates a temporary file with a unique file name in read-write (w+) mode.
The file will be automatically deleted after it is closed (using fclose()
), or when the script is finished.
<?php $temp = tmpfile ( ) ; fwrite ( $temp , "Testing, testing." ) ; //Rewind back to the beginning of the file rewind ( $temp ) ; //Read 1k from the file echo fread ( $temp , 1024 ) ; //Delete the file fclose ( $temp ) ; ?>
Output:
Testing, testing.
tmpfile ( )