php读取文本文件内容
在php语言中读取文件的方法很多,今天我们就来讲三种php读取文本文件内容实例吧,主要是用到fopen,file,file_get_contents函数来实现。
//fopen 读取文件实例
| 代码如下 | 复制代码 | 
$path ='a.txt';  | 
|
//file_get_contents读取文件
| 代码如下 | 复制代码 | 
if( file_exists( $path ) ) //file  | 
|
读取文本文件
| 代码如下 | 复制代码 | 
| $cbody = file($path); | |
print_r($cbody); //因为file读取出来的文件是以数组形式保存的,所以用print_r输出。
本文地址:http://www.phprm.com/code/34483.html
转载随意,但请附上文章地址:-)