html - How to echo all XML within an element in PHP? -
html - How to echo all XML within an element in PHP? -
this question has reply here:
php simplexml innerxml 10 answersi have piece of xml looks this:
<root> <element>normal,<b>bold</b></element> </root> how can utilize php echo within <element>, output "normal,<b>bold</b>"?
edit: here code:
<?php $xml = simplexml_load_file('xml_file.xml'); $element = $xml->element; echo $element[1]; ?> i "normal".
$xml = '<root> <element>normal,<b>bold</b></element> </root>'; $sxe = new simplexmlelement($xml); echo strip_tags($sxe->element->asxml());
you must strip tags when match element.
php html xml
Comments
Post a Comment