Home  >  Article  >  Backend Development  >  How to use readfile function

How to use readfile function

藏色散人
藏色散人Original
2019-02-18 10:06:027031browse

php readfile() function is used to output a file.

How to use readfile function

php readfile() function Syntax

Function: Output a file.

Syntax:

readfile(filename,include_path,context)

Parameters:

filename Required. Specifies the file to be read.

include_path Optional. If you also want to search for files in include_path, you can use this parameter and set it to true.

context Optional. Specifies the environment for a file handle. Context is a set of options that can modify the behavior of the stream.

Description: This function reads a file and writes it to the output buffer. If successful, returns the number of bytes read from the file. On failure, returns false.

php readfile() function example

<?php
echo readfile("./test.txt");
?>

This article is an introduction to the PHP readfile function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use readfile function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use file functionNext article:How to use file function