-
-
Save wenpeng/abd2385810d5d7aad742 to your computer and use it in GitHub Desktop.
Get innerHTML of a php DOMElement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// See http://www.php.net/manual/en/class.domelement.php#101243 | |
function get_inner_html( $node ) { | |
$innerHTML= ''; | |
$children = $node->childNodes; | |
foreach ($children as $child) { | |
$innerHTML .= $child->ownerDocument->saveXML( $child ); | |
} | |
return $innerHTML; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment