[英]Cakephp and PHP: How to change xml value in xml?
I want to update to_status value. 我想更新to_status值。
I have following xml file. 我有以下xml文件。
<challenges>
<challenge>
<challenge_id>1385</challenge_id>
<debate_id>988</debate_id>
<comment_id>157</comment_id>
<from_id>42</from_id>
<to_id>3</to_id>
<from_status> true</from_status>
<to_status> false</to_status>
<timestamp>1320933898</timestamp>
</challenge>
</challenges>
How can i update it? 我该如何更新?
Look into CakePHP's "XML" class. 查看CakePHP的“ XML”类。 In versions prior to 2.0, you have to "App::import('Xml')" the XML class but in 2.0 it is a core library.
在2.0之前的版本中,必须对XML类进行“ App :: import('Xml')”,但在2.0中,它是一个核心库。
With the XML class, you can render the XML as an array, manipulate it the way you want, and simply re-transform it into an XML string. 使用XML类,您可以将XML呈现为数组,以所需方式对其进行操作,然后将其重新转换为XML字符串。
Check out these links: 查看以下链接:
CakePHP 1.3 XML : http://book.cakephp.org/view/1473/XML CakePHP 1.3 XML: http : //book.cakephp.org/view/1473/XML
CakePHP 2.0 XML : http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html?highlight=xml CakePHP 2.0 XML: http : //book.cakephp.org/2.0/en/core-utility-libraries/xml.html? highlight=xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.