DOMDocument->save
(no version information, might be only in CVS)
DOMDocument->save --
Scarica in un file l'albero XML interno
Descrizione
int
DOMDocument->save ( string filename )
Crea un documento XML dalla rappresentazione DOM. Restituisce il
numero di byte scritti. Questa funzione solitamente si utilizza dopo avere creato
un nuovo documento da zero, come nell'esempio seguente.
Esempio 1. Creazione di un semplice header HTML
<?php $doc = new DOMDocument("1.0"); $root = $doc->createElement("HTML"); $root = $doc->appendChild($root); $head = $doc->createElement("HEAD"); $head = $root->appendChild($head); $title = $doc->createElement("TITLE"); $title = $head->appendChild($title); $text = $doc->createTextNode("This is the title"); $text = $title->appendChild($text); $doc->save("/tmp/test.xml"); ?>
|
|
Vedere anche DOMDocument->load(),
DOMDocument->loadXML()
e DOMDocument->saveXML().