將 PHP 的 DOMNode 內容取出
function DOMinnerHTML($element, $mb_convert_encoding = false) { $innerHTML = ""; $children = $element->childNodes; foreach ($children as $child) { $tmp_dom = new DOMDocument(); $tmp_dom->appendChild($tmp_dom->importNode($child, true)); $innerHTML.=trim($tmp_dom->saveHTML()); } if (!$mb_convert_encoding) { return $innerHTML; } else { return mb_convert_encoding($innerHTML, $mb_convert_encoding, 'HTML-ENTITIES'); } }