DOM
PHP Manual

DOMDocument->load()

(No version information available, might be only in CVS)

DOMDocument->load() — Load XML from a file

说明

DOMDocument
mixed load ( string $filename [, int $options ] )

Loads an XML document from a file.

参数

filename

The path to the XML document.

返回值

如果成功则返回 TRUE,失败则返回 FALSE。 If called statically, returns a DOMDocument but also causes an E_STRICT warning.

错误/异常

If an empty string is passed as the filename or an empty file is named, a warning will be generated. This warning is not generated by libxml and cannot be handled using libxml's error handling functions.

范例

Example#1 Creating a Document

<?php
$doc 
= new DOMDocument();
$doc->load('book.xml');
echo 
$doc->saveXML();
?>

参见


DOM
PHP Manual