PHP readfile() İşlevi
❮ PHP Dosya Sistemi ReferansıÖrnek
Bir dosyayı okuyun:
<?php
echo readfile("test.txt");
?>
Tanım ve Kullanım
readfile() işlevi bir dosyayı okur ve onu çıktı arabelleğine yazar.
İpucu: php.ini dosyasında fopen sarmalayıcıları etkinleştirilmişse, bu işlevle bir URL'yi dosya adı olarak kullanabilirsiniz.
Sözdizimi
readfile(file, include_path, context)
Parametre Değerleri
Parameter | Description |
---|---|
file | Required. Specifies the file to read |
include_path | Optional. Set this parameter to TRUE if you want to search for the file in the include_path (in php.ini) as well |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream |
Teknik detaylar
Geri dönüş değeri: | Başarı durumunda okunan bayt sayısı, YANLIŞ ve başarısızlık durumunda hata. İşlev adının önüne bir '@' ekleyerek hata mesajını gizleyebilirsiniz. |
---|---|
PHP Sürümü: | 4.0+ |
PHP Değişiklik Günlüğü: | PHP 5.0: Bağlam desteği eklendi |
❮ PHP Dosya Sistemi Referansı