PHP实现浏览器格式化显示XML的方法示例
发布时间:2022-10-29 01:24:13 328 相关标签:
$Dom=new \DOMDocument('1.0', 'utf-8');
$paper=$Dom->createElement('paper');
$Dom->appendChild($paper);
$exercises=$Dom->createElement('exercises');
$exercises->setAttribute('id','1');
$exercises->setAttribute('type','1');
$exercises->setAttribute('answer','1');
$paper->appendChild($exercises);
$title=$Dom->createElement('title');
$title->setAttribute('label','1');
$title->setAttribute('mapsrc','1');
$title->setAttribute('soundsrc','1');
$exercises->appendChild($title);
$option=$Dom->createElement('option');
$option->setAttribute('id','1');
$option->setAttribute('label','1');
$option->setAttribute('mapsrc','1');
$option->setAttribute('soundsrc','1');
$exercises->appendChild($option);
header("Content-type: application/xml");
echo $Dom->saveXml(); exit;
文章来源: https://blog.51cto.com/yetaotao/5796242
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报