I have an xml file that I can pull using php and display the results. I need to pick up one of the xml tags and add a link inside it so I can parse the value in the tag as a php variable. eg
<name>Llandaff</name>
<firmid>70330</firmid>
<branchid>2</branchid>
I want to add a link so the new xml file would be:
<name>Llandaff</name>
<firmid><a href="index.php?firmID=70330"></a></firmid>
<branchid>2</branchid>
Wrap it into <![CDATA[]]>
:
<firmid><![CDATA[<a href="index.php?firmID=70330"></a>]]></firmid>
To do this with simplexml
, see accepted answer in this post: How to write CDATA using SimpleXmlElement?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.