PHP中读写文件实现代码

2019-04-08 22:19:38于海丽

if(!$flag)
{
echo "写入文件失败<br>";
break;
}
$count+=$flag;
}
echo "共写入".$count."个字符";
}
else
{
echo "打开文件失败";
}
fclose($fp);
?>

页面输出的结果为:

共写入100个字符
test.txt文件会被写入:

行1 : Hello World!
行2 : Hello World!
行3 : Hello World!
行4 : Hello World!
行5 : Hello World!
  
注:为了简化操作,部分函数的可选参数没有列出。
相关文章 大家在看