[英]how to send value to exists tag in xml file usuing PHP
<input name="CONTACT_PHONE" placeholder="contact phone" class="form-control" type="text">
通过POST获取代码
$contactphone = $_POST['CONTACT_PHONE'];
加载xml文件
$xml = simplexml_load_file("JOBS.xml");
得到存在的标签
$tagcontactphone = xml -> getElementsByTagName("CONTACT_PHONE")
如何将$contactphone
放入$tagcontactphone
并保存xml文件?
你可以把它与等号
$xml->getElementsByTagName("CONTACT_PHONE") = $contactphone;
您可以保存更新的XML或发送它
file_put_contents('newfile.xml', $xml->asXML());
echo $xml->asXML();
查看文档: SimpleXML基本用法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.