PHP asXML() 函数
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();
?>
$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+ |

相关文章
- PHP 教程
- PHP echo 和 print 语句
- PHP 字符串
- PHP 数组排序
- PHP For 循环
- PHP 函数
- PHP 面向对象
- PHP 包含文件 include 和 require 语句
- PHP 文件上传
- PHP 错误处理
- PHP array_diff_ukey() 函数
- PHP array_replace_recursive() 函数
- PHP array_uintersect_uassoc() 函数
- PHP array_values() 函数
- PHP natcasesort() 函数
- PHP sort() 函数
- PHP 5 Directory 函数
- PHP Error 和 Logging 函数
- PHP HTTP 函数
- PHP PDO