php逐行读取文件范例代码,通过fopen打开文件,fgets读取文件,fclose关闭文件
<?php $file = fopen("welcome.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached while(!feof($file)) { echo fgets($file). "<br />"; } fclose($file); ?>
php逐行读取文件范例代码,通过fopen打开文件,fgets读取文件,fclose关闭文件
<?php $file = fopen("welcome.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached while(!feof($file)) { echo fgets($file). "<br />"; } fclose($file); ?>