PHP tmpfile() Function
Complete PHP Filesystem Reference
Definition and Usage
The tmpfile() function creates a temporary file with a unique name in
read-write (w+) mode.
Syntax
Tips and Notes
Note: The temporary file is automatically removed when it is closed
with fclose(), or when the script ends.
Tip: See also tempnam()
Example
<?php
$temp = tmpfile();
fwrite($temp, "Testing, testing.");
//Rewind to the start of file
rewind($temp);
//Read 1k from file
echo fread($temp,1024);
//This removes the file
fclose($temp);
?>
|
The output of the code above will be:
Complete PHP Filesystem Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|