Home > Article > Backend Development > PHP 读取TXT文本有关问题
PHP 读取TXT文本问题
我想读取a.txt中第二个$,到第三个$之间的数据怎么弄谢谢了!!!
$fp = fopen('filename', 'r');<br /> $num = 0;<br /> $s = '';<br /> while($ch = fgetc($fp)) {<br /> if($ch == '$') {<br /> $num++;<br /> if($num > 2) break;<br /> }elseif($num == 2) $s .= $ch;<br /> }<br /> echo $s;