readfile() 函数输出一个文件。
该函数读入一个文件并写入到输出缓冲。
若成功,则返回从文件中读入的字节数。若失败,则返回 false。您可以通过 @readfile() 形式调用该函数,来隐藏错误信息。
readfile(filename,include_path,context)
参数 | 描述 |
---|---|
filename | 必需。规定要读取的文件。 |
include_path | 可选。如果也想在 include_path 中搜索文件,可以使用该参数并将其设为 true。 |
context | 可选。规定文件句柄的环境。Context 是可以修改流的行为的一套选项。 |
对 context 参数的支持是 PHP 5.0.0 添加的。
<?php
echo readfile("test.txt");
?>
输出:
There are two lines in this file.
This is the last line.
57
©2020 IT自习室京ICP备20010815号