如何检查txt文件的行尾php [英] how to check end of line of txt file php
本文介绍了如何检查txt文件的行尾php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查是否到达行尾但是当我运行时
代码它没有显示任何内容,尽管文件内容为
我的代码如下
i want to check if the end of line is reached but when i run
the code it doesn''t show anything although the file has contents
my code is as following
<?php
/**
* @author gencyolcu
* @copyright 2013
*/
$file=fopen("m.txt","r+") or exit("couldn't open file");
while(!PHP_EOL)
{
echo fgets($file). "<br />";
}
fclose($file);
?>
推荐答案
file = fopen( m.txt, r +)或 exit( 无法打开文件);
while(!PHP_EOL)
{
echo fgets(
file=fopen("m.txt","r+") or exit("couldn't open file"); while(!PHP_EOL) { echo fgets(
文件)。 < br />;
}
fclose(
file). "<br />"; } fclose(
file);
?>
file); ?>
这篇关于如何检查txt文件的行尾php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文