PHP tmpfile () function
Definisi dan Penggunaan
tmpfile () fungsi menciptakan file sementara dengan nama file yang unik di read-write (w +) modus.
tatabahasa
tmpfile()
Tips dan Catatan
Catatan: Sementara file setelah file ditutup (menggunakan fclose ()), atau ketika script berakhir secara otomatis dihapus.
Tip: Lihat tempnam ().
contoh
<?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);
?>
$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);
?>
Kode di atas akan menampilkan:
Testing, testing.
Lengkapi manual PHP Filesystem Referensi