PHP读取TXT问题2

WBOY
Release: 2016-06-23 14:02:25
Original
841 people have browsed it

我想读取a.txt中出现第二次$,到第三次出现$之间的数据怎么弄谢谢了!!!($ 不是单独的字符:没准是1$711197,也没准是False$711197,格式都不太一样)谢谢各位了


回复讨论(解决方案)

  $r0 = explode("$",$row[]);//分段,$r0[1]就是第一个$后面的所有字符
  $r1 = explode("$",$r0[1]); //分段,$r1[0]就是第二个$前面的所有字符

1.一个一个字节读出来;
2.与‘$’进行对比;
3.第一次出现后,将后面的字节逐一存入字符串,直到第二次出现‘$’。

$s=file_get_contents('a.txt');$arr=explode('$',$s);echo $arr[2];
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template