PHP fwrite() İşlevi
❮ PHP Dosya Sistemi ReferansıÖrnek
Açık bir dosyaya yazın:
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
?>
Yukarıdaki kodun çıktısı şöyle olacaktır:
21
Tanım ve Kullanım
fwrite() açık bir dosyaya yazar.
İşlev, hangisi önce gelirse, dosyanın sonunda (EOF) veya belirtilen uzunluğa ulaştığında duracaktır.
Sözdizimi
fwrite(file, string, length)
Parametre Değerleri
Parameter | Description |
---|---|
file | Required. Specifies the open file to write to |
string | Required. Specifies the string to write to the open file |
length | Optional. Specifies the maximum number of bytes to write |
Teknik detaylar
Geri dönüş değeri: | Yazılan bayt sayısı, hata durumunda YANLIŞ |
---|---|
PHP Sürümü: | 4.0+ |
İkili Kasa: | Evet |
❮ PHP Dosya Sistemi Referansı