1

如何使用 Simple HTML DOM Parser 找到“请再次输入有效密钥”的内容?

例子:

<script language="javascript">
     function Enable() {      
        alert('Please enter a valid key again');
     }
</script>

这似乎不起作用:

<?php

include_once("simple_html_dom.php");

$html = file_get_html("incorrect.html");

$ret = $html->find("Please enter a valid key again", 0);

if ($ret) {
    echo "found";
} else {
    echo "not found";
}
?>
4

1 回答 1

4

您可以以更简单的方式执行此操作:

<?php    
include_once("simple_html_dom.php");        
$html = file_get_html('incorrect.html');
(strstr($html,'Please enter a valid key again')) ? print("found") : print("not found");
?>
于 2011-06-30T23:50:06.660 回答