PHP readfile() 函数
PHP 教程
· 2019-01-25 14:14:33
定义和用法
readfile() 函数读取一个文件,并写入到输出缓冲。
如果成功,该函数返回从文件中读入的字节数。如果失败,该函数返回 FALSE 并附带错误信息。您可以通过在函数名前面添加一个 '@' 来隐藏错误输出。
语法
readfile(filename,include_path,context)
| 参数 | 描述 |
|---|---|
| filename | 必需。规定要读取的文件。 |
| include_path | 可选。如果您还想在 include_path(在 php.ini 中)中搜索文件的话,请设置该参数为 '1'。 |
| context | 可选。规定文件句柄的环境。context 是一套可以修改流的行为的选项。 |
提示和注释
提示:如果在 php.ini 文件中 "fopen wrappers" 已经被激活,您可以在本函数中把 URL 作为文件名来使用。
实例
<?php
echo readfile("test.txt");
?>
上面的代码将输出:
There are two lines in this file. This is the last line. 57
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Host Your Web Site In The Cloud
Jeff Barr / SitePoint / 2010-9-28 / USD 39.95
Host Your Web Site On The Cloud is the OFFICIAL step-by-step guide to this revolutionary approach to hosting and managing your websites and applications, authored by Amazon's very own Jeffrey Barr. "H......一起来看看 《Host Your Web Site In The Cloud》 这本书的介绍吧!