File PHP () Fungsi
Referensi Sistem File PHPContoh
Baca file ke dalam array:
<?php
print_r(file("test.txt"));
?>
Definisi dan Penggunaan
File() membaca file ke dalam array.
Setiap elemen array berisi satu baris dari file, dengan karakter baris baru masih terpasang.
Sintaksis
file(filename, flag, context)
Nilai Parameter
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. |
Detail Teknis
Nilai Kembali: | Seluruh file dalam array, SALAH saat gagal |
---|---|
Versi PHP: | 4.0+ |
Biner Aman: | Ya, di PHP 4.3 |
Referensi Sistem File PHP