“Func simplexml asxml”的版本间差异
本页内容
(创建页面,内容为“{{DISPLAYTITLE:asXML()}}4 = PHP asXML() 函数 = PHP SimpleXML 参考手册 格式化 XML(版本 1.0)中的 SimpleXML 对象的数据: <sample title="" desc="" lang="php" hererun="1">example_start <?php $note=<<<XML <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> XML; $xml=new SimpleXMLElement($note); echo $xml->asXML…”) |
无编辑摘要 |
||
第1行: | 第1行: | ||
{{DISPLAYTITLE: | {{DISPLAYTITLE:saveXML()}}[[Category:PHP SimpleXML 函数参考手册|12]] | ||
= PHP asXML() 函数 = | = PHP asXML() 函数 = | ||
2022年8月17日 (三) 22:28的版本
PHP asXML() 函数
格式化 XML(版本 1.0)中的 SimpleXML 对象的数据:
示例
<?php
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML;
$xml=new SimpleXMLElement($note);
echo $xml->asXML();
?>
定义和用法
asXML() 函数格式化 XML(版本 1.0)中的 SimpleXML 对象的数据。
语法
asXML(filename);
参数 | 描述 |
---|---|
filename | 可选。规定需要写入数据的文件的名称。 |
技术细节
返回值: | 如果成功则返回一个字符串,如果失败则返回 FALSE。如果指定了 filename 参数,成功则返回 TRUE,失败则返回 FALSE。 |
PHP 版本: | 5.0.1+ |