我正在尝试使用 php 在 html 文档中查找一个元素。
include_once('simple_html_dom.php');
$handle = fopen("exercise/Exercise.php", "r");
$file = fread($handle ,8192);
$handle = file_get_html('exercise/Exercise.php');
if (!empty($handle)) {
$ret = $handle->find('div[id=abc]');
}
但我不知道现在如何处理$ret
? 甚至检查它是否发现<div id="abc">
?这甚至是我不知道的正确方法,因为我不太擅长 php?
编辑这个问题对我来说是巨大的理解方式。
它应该是
$handle->find('div[id=abc]', 0);