在抓取我的 html 页面后,我试图从 phpquery 获取节点值。
$doc = phpQuery::newDocumentFileHTML('myurl');
foreach($doc['#filter-reload.row h1'] as $value)
{
print_r($value);
exit;
}
我得到的输出为
DOMElement Object ( [tagName] => h1 [schemaTypeInfo] => [nodeName] => h1
[nodeValue] => Oz The Great And Powerful (PG) [nodeType] => 1 [parentNode] => (object value omitted)
[childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted)
我只想要 nodeValue 作为输出......但是如何得到它?
我试过:-
$doc['#filter-reload.row h1']->nodeValue //not working
$doc['#filter-reload.row h1']['nodeValue']//notworking