搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
服务端开发
PHP 教程
PHP 高级教程
源代码
清空
点击运行
<?php $file = "data.txt"; //检查文件是否存在 if(file_exists($file)){ //将整个文件读入数组 $arr = file($file) or die("ERROR: Cannot open the file."); foreach($arr as $line){ echo $line; } } else{ echo "ERROR: File does not exist."; } ?>
运行结果