دالة PHP fwrite ()
❮ مرجع نظام ملفات PHPمثال
اكتب في ملف مفتوح:
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
?>
ناتج الكود أعلاه سيكون:
21
التعريف والاستخدام
يكتب fwrite () في ملف مفتوح.
ستتوقف الوظيفة في نهاية الملف (EOF) أو عندما تصل إلى الطول المحدد ، أيهما يأتي أولاً.
بناء الجملة
fwrite(file, string, length)
قيمه المعامل
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 |
تفاصيل تقنية
قيمة الإرجاع: | عدد البايتات المكتوبة ، FALSE عند الفشل |
---|---|
إصدار PHP: | 4.0+ |
ثنائي آمن: | نعم |
❮ مرجع نظام ملفات PHP