In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to modify data in php simplexml". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Php simplexml modify data methods: 1, create PHP sample file and set the encoding format; 2, create XML format string; 3, through "simplexml_load_string ($str);" create SimpleXML object; 4, modify the element value.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How does php simplexml modify the data?
SimpleXML of PHP modifies XML data
One code
PHP from getting started to mastering XML;/* / / * create SimpleXML objects * / $xml = simplexml_load_string ($str); / * output the value of root attribute name * / echo $xml [name].' / * modify the attribute value of the child element computerbook type * / $xml- > book- > computerbook ['type'] = iconv (' essential tools for gb2312','utf-8','PHP programmers'); / * modify the value of the child element computerbook * / $xml- > book- > computerbook = iconv ('gb2312','utf-8','PHP function reference'); / * output the modified attribute and element values * / echo $xml- > book- > computerbook ['type']. Echo $xml- > book- > computerbook;? >
Second operation result
Merchandise
Essential tools for PHP programmers = > PHP function reference
This is the end of "how to modify data in php simplexml". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.