PHP tmpfile() İşlevi
❮ PHP Dosya Sistemi ReferansıÖrnek
Okuma-yazma (w+) modunda benzersiz bir ada sahip geçici bir dosya oluşturun:
<?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);
?>
Yukarıdaki kodun çıktısı şöyle olacaktır:
Testing, testing.
Tanım ve Kullanım
tmpfile() işlevi, okuma-yazma (w+) modunda benzersiz bir ada sahip geçici bir dosya oluşturur.
Not: Dosya kapatıldığında, fclose() ile veya komut dosyası sona erdiğinde otomatik olarak kaldırılır.
İpucu: Ayrıca tempnam() işlevine bakın.
Sözdizimi
tmpfile()
Teknik detaylar
Geri dönüş değeri: | Bir dosya tanıtıcısı (yeni dosya için fopen() tarafından döndürülene benzer), hata durumunda FALSE |
---|---|
PHP Sürümü: | 4.0+ |
❮ PHP Dosya Sistemi Referansı