Readfile () function

Source: Internet
Author: User
Tags readfile

Definition and usage

The readfile () function outputs a file.

This function reads a file and writes it to the output buffer.

If yes, the number of bytes read from the file is returned. If it fails, false is returned. You can call this function in the form of @ readfile () to hide the error message.

Syntax
 
Readfile (Filename,Include_path,Context)
Parameters Description
Filename Required. Specifies the file to be read.
Include_path Optional. If you wantInclude_pathYou can use this parameter and set it to true.
Context Optional. Specifies the file handle environment.ContextIs a set of options that can modify the behavior of a stream.

 

 

 

Description

PairContextThe supported parameters are added in PHP 5.0.0.

Tips and comments

Tip: If "fopen wrappers" has been activated in the PHP. ini file, you can use the URL as the file name in this function.

Example
<? Phpecho readfile ("test.txt");?>

Output:

 
There are two lines in this file. This is the last line.57

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.