2012-08-26 21 views
1

var_dump是給我:獲取數據來自的var_dump

object(QueryPath)#2 (7) { 
    ["errTypes":"QueryPath":private]=> int(257) 
    ["document":protected]=> object(DOMDocument)#3 (34) { 
     ["doctype"]=> string(22)"(object value omitted)" 
     ["implementation"]=> string(22) "(object value omitted)" 
     ["documentElement"]=> string(22) "(object value omitted)" 
     ["actualEncoding"]=> string(5) "UTF-8" 
     ["encoding"]=> string(5) "UTF-8" 
     ["xmlEncoding"]=> string(5) "UTF-8" 
     ["standalone"]=> bool(true) 
     ["xmlStandalone"]=> bool(true) 
     ["version"]=> NULL 
     ["xmlVersion"]=> NULL 
     ["strictErrorChecking"]=> bool(true) 
     ["documentURI"]=> string(26) "http://www.therock.net.nz/" 
     ["config"]=> NULL 
     ["formatOutput"]=> bool(false) 
     ["validateOnParse"]=> bool(false) 
     ["resolveExternals"]=> bool(false) 
     ["preserveWhiteSpace"]=> bool(true) 
     ["recover"]=> bool(false) 
     ["substituteEntities"]=> bool(false) 
     ["nodeName"]=> string(9) "#document" 
     ["nodeValue"]=> NULL 
     ["nodeType"]=> int(13) 
     ["parentNode"]=> NULL 
     ["childNodes"]=> string(22) "(object value omitted)" 
     ["firstChild"]=> string(22) "(object value omitted)" 
     ["lastChild"]=> string(22) "(object value omitted)" 
     ["previousSibling"]=> NULL 
     ["attributes"]=> NULL 
     ["ownerDocument"]=> NULL 
     ["namespaceURI"]=> NULL 
     ["prefix"]=> string(0) "" 
     ["localName"]=> NULL 
     ["baseURI"]=> NULL 
     ["textContent"]=> string(48034) 
    } 
} 

我怎麼會拉["textContent"]

我目前的索引頁:

$loadRock = $system->get_theRock(); 

var_dump($loadRock); 

回答

1

嘗試$ loadRock-> html();或$ loadRock-> text();

+0

鮑里斯是對的。 QP-> text()會對DOM文本節點進行一些處理。如果您需要對基礎DOMText節點進行細粒度控制,您也可以使用$ qp-> get(),然後迭代子節點,選取循環中的文本節點。然而,這是一大痛苦。 – Technosophos

1

textContentDOMDocument對象,這是屬性document的屬性,但這種屬性爲protected,這樣你就可以不通過$loadRock->document->textContent得到它。

您需要檢查QueryPath的文檔,看看是否有訪問document屬性或其他的方法。

相關問題