tmpfile
一時ファイルを作成します
tmpfile()
関数は、read-write(w+)モードで一意のファイル名を持つ一時ファイルを作成します。
ファイルは、閉じた後( fclose()
を使用)、またはスクリプトが終了した後に自動的に削除されます。
<?php $ temp = tmpfile ( ) ; fwrite ( $ temp 、 "テスト、テスト。" ) ; //ファイルの先頭に巻き戻します Rewind ( $ temp ) ; //ファイルから1kを読み取ります Echo Fread ( $ TEMP 、 1024 ) ; //ファイルを削除します fclose ( $ temp ) ; ?>
出力:
テスト、テスト。
tmpfile ( )