PHP file_get_contents() 函数 |
发布时间: 2012/9/1 16:36:03 |
定义和用法file_get_contents() 函数把整个文件读入一个字符串中。
和 file() 一样,不同的是 file_get_contents() 把文件读入一个字符串。
file_get_contents() 函数是用于将文件的内容读入到一个字符串中的首选方法。如果操作系统支持,还会使用内存映射技术来增强性能。
语法file_get_contents(path,include_path,context,start,max_length)
说明对 context 的支持是 PHP 5.0.0 添加的。 提示和注释注释:本函数可安全用于二进制对象。 例子<?php print_r(file("test.txt")); ?> 输出: Array ( [0] => Hello World. Testing testing! [1] => Another day, another line. [2] => If the array picks up this line, [3] => then is it a pickup line? ) 本文出自:亿恩科技【www.enkj.com】 |