标签:style class blog code ext color
php逐行读取文本文件的内容。
php文件
$handler = fopen(‘test6.txt‘,‘r‘); //打开文件 while(!feof($handler)){ $m[] = fgets($handler,4096); //fgets逐行读取,4096最大长度,默认为1024 } fclose($handler); //关闭文件 //输出文件 echo ‘<pre>‘; print_r($m); echo ‘</pre>‘;
Text文本
ddddds sdfasdfa dfasdfa lk;k;kh;k dddfsfas sdfasdfa dddd dsflka;lsdk
结果
Array ( [0] => ddddds [1] => sdfasdfa [2] => dfasdfa [3] => lk;k;kh;k [4] => dddfsfas [5] => sdfasdfa [6] => dddd [7] => dsflka;lsdk )
PHP逐行读取Text文本文件,布布扣,bubuko.com
标签:style class blog code ext color
原文地址:http://www.cnblogs.com/scriptlift/p/3790986.html