PHP怎么写XML

WBOY
Release: 2016-06-13 13:30:55
Original
1199 people have browsed it

PHP如何写XML
在PHP文件中有一个$_SESSION['phone'],想把它的值写入XML文件,该怎样实现?

------解决方案--------------------
http://www.jb51.net/article/21450.htm
------解决方案--------------------
XML与PHP相互转换封装函数:xmlparse.php
Demo:

PHP code

include(dirname(__FILE__)."/xmlparse.php");
$arr = array(1,"name","admin",100);
$contXML = dump_xml_config($arr, "xml", "utf-8");
//放入文件
file_put_contents_safe("/path/test.xml",$contXML,"w");
echo $contXML;
#源码
#<?xml version="1.0" encoding="utf-8"?>
#<xml>
#    10>
#    name1>
#    admin2>
#    1003>
#</xml>
<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨

XML与PHP相互转换封装函数:xmlparse.php
Demo:
PHP code

include(dirname(__FILE__)."/xmlparse.php");
$arr = array(1,"name","admin",100);
$contXML = dump_xml_config($arr, "xml", "utf-8");
//放入文件
file_put_conte……
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!