PHP readfile() Functie
❮ Referentie voor PHP-bestandssysteemVoorbeeld
Lees een bestand:
<?php
echo readfile("test.txt");
?>
Definitie en gebruik
De functie readfile() leest een bestand en schrijft het naar de uitvoerbuffer.
Tip: Je kunt bij deze functie een URL als bestandsnaam gebruiken als de fopen-wrappers zijn ingeschakeld in het php.ini-bestand.
Syntaxis
readfile(file, include_path, context)
Parameterwaarden
Parameter | Description |
---|---|
file | Required. Specifies the file to read |
include_path | Optional. Set this parameter to TRUE if you want to search for the file in the include_path (in php.ini) as well |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream |
Technische details
Winstwaarde: | Het aantal gelezen bytes bij succes, FALSE en een fout bij mislukking. U kunt de foutmelding verbergen door een '@' voor de functienaam toe te voegen |
---|---|
PHP-versie: | 4.0+ |
PHP-wijzigingslogboek: | PHP 5.0: contextondersteuning toegevoegd |
❮ Referentie voor PHP-bestandssysteem