0
<?php
$a = 'grzn.txt';
if (strpos($a, 'word') !== false)
{
echo 'Found';
}
?>
如何检查“word”是否在文本文件“grzn.txt”中? &谢谢如何检查一个txt文件是否包含一个词
<?php
$a = 'grzn.txt';
if (strpos($a, 'word') !== false)
{
echo 'Found';
}
?>
如何检查“word”是否在文本文件“grzn.txt”中? &谢谢如何检查一个txt文件是否包含一个词
您应该搜索文本内容,而不是在文件名内。
使用file_get_contents
功能:
$a = 'grzn.txt';
if (strpos(file_get_contents($a), 'word') !== false) echo 'found';