php生成xml文件

2025-05-19 18:34:44

1、$doc=new DOMDocument("1.0","utf8");$doc->formatOutput=true;$doc->save("aaa.xml");//保存文件输入本地网址显示空白页面,但是本地文件夹中生成xml文件

php生成xml文件php生成xml文件

4、$info=$doc->createElement("Info");$infoTextNode=$doc->createTextNode("xml");$info->appendchild($infoTextNode);$root->appendchild($info);//创建<info>标签

php生成xml文件

5、//xml标签都是嵌套方式生成的//比如生成<user>标签$user=$doc->createElement("user");$root->appendchild($user);

php生成xml文件

7、$url=$doc->createElement("url争犸禀淫");$urlTextNode=$doc->createTextNode("稆糨孝汶;http://www.yuzh.com");$url->appendchild($urlTextNode);$user->appendchild($url);$author=$doc->createElement("author");$authorTextNode=$doc->createTextNode("da海");$author->sex=$doc->createElement("sex");$authorTextNode->sexTextNode=$doc->createTextNode("男");$author->sex->appendchild($authorTextNode->sexTextNode);$author->appendchild($authorTextNode);$user->appendchild($author);

php生成xml文件
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢