$store = curl_exec($ch); // Returns a page of HTML
$doc = new DOMDocument();
$doc->loadHTML($store);
$xpath = new DOMXpath($doc);
Vardump $xpath
:DOMXPath的var_dump: “(略对象的值)”
object(DOMXPath)#2 (1) {
["document"] => string(22) "(object value omitted)"
}
这里有什么问题?我试图在HTML代码上使用xpath来提取信息。
object(DOMDocument)#1 (34) {
["doctype"] => string(22) "(object value omitted)"
["implementation"] => string(22) "(object value omitted)"
["documentElement"] => string(22) "(object value omitted)"
["actualEncoding"] => string(6) "gb2312"
["encoding"] => string(6) "gb2312"
["xmlEncoding"] => string(6) "gb2312"
["standalone"] => bool(true)
...
这不是XPath如何...... XPath是DOM搜索引擎文件,它不是你载入的文件。 –