Uma área de pesquisa sobre o WordPress para devs e autores do tema



savedomdocument ›

Desde2.8.0
Obsoleton/a
savedomdocument ( $doc, $filename )
Parâmetros: (2)
  • (DOMDocument) $doc
    Required: Yes
  • (string) $filename
    Required: Yes
Definido em:
Codex:

Saves the XML document into a file



Fonte

function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	$config = $doc->saveXML();
	$config = preg_replace( "/([^\r])\n/", "$1\r\n", $config );
	$fp     = fopen( $filename, 'w' );
	fwrite( $fp, $config );
	fclose( $fp );
}