20,359
社区成员
发帖
与我相关
我的任务
分享
$file_path = "test.txt";
if(file_exists($file_path)){
$fp = fopen($file_path,"r");
$str = fread($fp,filesize($file_path));//指定读取大小,这里把整个文件内容读取出来
echo $str;
fclose($fp);
}
#第二种
把 fopen 换成 file_get_contents
#第三种
fopen 配合 fgets 获取文件内容
#第四中
fopen配合 while 循环 获取