ملف PHP () الوظيفة
❮ مرجع نظام ملفات PHPمثال
قراءة ملف في مصفوفة:
<?php
print_r(file("test.txt"));
?>
التعريف والاستخدام
يقرأ الملف () ملفًا في مصفوفة.
يحتوي كل عنصر مصفوفة على سطر من الملف ، مع استمرار إرفاق حرف السطر الجديد.
بناء الجملة
file(filename, flag, context)
قيمه المعامل
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file to read |
flag |
Optional. Can be one or more of the following constants:
|
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. Can be skipped by using NULL. |
تفاصيل تقنية
قيمة الإرجاع: | الملف بأكمله في مصفوفة FALSE عند الفشل |
---|---|
إصدار PHP: | 4.0+ |
ثنائي آمن: | نعم ، في PHP 4.3 |
❮ مرجع نظام ملفات PHP