没有合适的资源?快使用搜索试试~ 我知道了~
php动态生成xml文件
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
一个php小程序,动态生成xml文件,读者可以在此基础上进行扩展,如读取DB数据再循环生成xml标签等等。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![php](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
<?php
//此小程序创建了Person父节点,然后创建Sex和Name子节点,并填充内容
//读者可以在此基础上扩展,如创建name的子节点等等
//创建对象
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
//创建Person父节点
$person = $doc->appendChild($doc->createElement("Person"));
//创建Sex子节点
$sexInfo = $person->appendChild($doc->createElement("Sex"));
//为Sex子节点添加内容
$sexInfo->appendChild($doc->createElement("Sex_ID",0));
$sexInfo->appendChild($doc->createElement("Sex_Name","男"));
$sexInfo = $person->appendChild($doc->createElement("Sex"));
$sexInfo->appendChild($doc->createElement("Sex_ID",1));
$sexInfo->appendChild($doc->createElement("Sex_Name","女"));
//创建Name子节点并添加信息
$nameInfo = $person->appendChild($doc->createElement("Name"));
$nameInfo->appendChild($doc->createElement("Sex_ID",0));
$nameInfo->appendChild($doc->createElement("Name","Vincent"));
$nameInfo = $person->appendChild($doc->createElement("Name"));
$nameInfo->appendChild($doc->createElement("Sex_ID",1));
$nameInfo->appendChild($doc->createElement("Name","Jakky"));
//此小程序创建了Person父节点,然后创建Sex和Name子节点,并填充内容
//读者可以在此基础上扩展,如创建name的子节点等等
//创建对象
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
//创建Person父节点
$person = $doc->appendChild($doc->createElement("Person"));
//创建Sex子节点
$sexInfo = $person->appendChild($doc->createElement("Sex"));
//为Sex子节点添加内容
$sexInfo->appendChild($doc->createElement("Sex_ID",0));
$sexInfo->appendChild($doc->createElement("Sex_Name","男"));
$sexInfo = $person->appendChild($doc->createElement("Sex"));
$sexInfo->appendChild($doc->createElement("Sex_ID",1));
$sexInfo->appendChild($doc->createElement("Sex_Name","女"));
//创建Name子节点并添加信息
$nameInfo = $person->appendChild($doc->createElement("Name"));
$nameInfo->appendChild($doc->createElement("Sex_ID",0));
$nameInfo->appendChild($doc->createElement("Name","Vincent"));
$nameInfo = $person->appendChild($doc->createElement("Name"));
$nameInfo->appendChild($doc->createElement("Sex_ID",1));
$nameInfo->appendChild($doc->createElement("Name","Jakky"));
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- ljj2848604752015-01-08实用性不算好,但可供学习
- liulei01022019-05-07很好很不错
- kuangyanmei62012-12-12比较简单,意义不是很大
- h855182011-09-10不是很实用,仅供参考。
![avatar](https://profile-avatar.csdnimg.cn/2be684631cc344028c9ed16d4c87e8fc_zhuang3028.jpg!1)
VINCENT
- 粉丝: 9
- 资源: 9
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)