PHP 中的 readfile() 函数

phpprogrammingserver side programming更新于 2025/8/31 2:52:17

readfile() 函数读取文件并将其写入输出缓冲区。

语法

readfile(file_path, include_path, context)

参数

  • file_path − 文件路径

  • include_path − 如果要在 include_path 中搜索文件,请将此参数设置为 TRUE。

  • context − 指定流的行为。

返回

readfile() 函数返回从文件。

示例

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

以下是返回字节数的输出。

输出

This is demo text!
18

相关文章