0

如果我fopen在文件上使用,有没有办法扫描文件以查找某个关键字开始的字节数?如果没有,我该怎么做?

4

2 回答 2

0

单程,

$data = file_get_contents("file");
print strpos("$data","myword");
于 2010-01-19T04:03:11.673 回答
0

您对这个问题的表述方式听起来像是您在寻找基本字符串操作以外的东西。如果这就是您所说的 - 不,字符串函数是您唯一的选择。

像往常一样获取内容。

$content = fread($file_handle, filesize($filename));
$index = strpos($content, 'keyword');
于 2010-01-19T04:06:42.010 回答