PHP -bestand() Functie
❮ Referentie voor PHP-bestandssysteemVoorbeeld
Lees een bestand in een array:
<?php
print_r(file("test.txt"));
?>
Definitie en gebruik
De file() leest een bestand in een array.
Elk array-element bevat een regel uit het bestand, met het newline-teken er nog aan.
Syntaxis
file(filename, flag, context)
Parameterwaarden
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. |
Technische details
Winstwaarde: | Het hele bestand in een array, ONWAAR bij fout |
---|---|
PHP-versie: | 4.0+ |
Binaire kluis: | Ja, in PHP 4.3 |
❮ Referentie voor PHP-bestandssysteem