超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<file_existsfile_put_contents>
Last updated: Fri, 22 Jun 2007

file_get_contents

(PHP 4 >= 4.3.0, PHP 5)

file_get_contents -- 将整个文件读入一个字符串

说明

string file_get_contents ( string filename [, int use_include_path [, resource context]])

file() 一样,只除了 file_get_contents() 将文件返回为一个字符串。

file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。

注: 该函数适用于二进制对象!

提示: 如果“fopen wrappers”已经被激活,则您在使用该函数的时候,可以把 URL 作为文件名来使用。请参阅 fopen() 获取怎样指定文件名的详细信息以及支持的 URL 协议的列表附录 L

注: Context 支持是 PHP 5.0.0 新加的。

参见 fgets()file()fread()include()readfile()




add a note add a note User Contributed Notes
file_get_contents
aidan at php dot net
21-May-2004 10:09
This functionality is now implemented in the PEAR package PHP_Compat.

More information about using this function without upgrading your version of PHP can be found on the below link:

http://pear.php.net/package/PHP_Compat

<file_existsfile_put_contents>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22