Home  >  Article  >  Backend Development  >  怎么判断一个字符串是否存在txt里面

怎么判断一个字符串是否存在txt里面

WBOY
WBOYOriginal
2016-06-13 10:51:151178browse

如何判断一个字符串是否存在txt里面
js.txt 内容是


13600000000
13788888888
13666666666
18999999999

我想判断

$mobile = "13788888888";

是否存在 txt里面




------解决方案--------------------
$s=file_get_contents('js.txt');
if(strpos($s,$mobile) !==false) echo '存在';
else echo '不存在';

Statement:
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