WordPress开发者和主题制作者的搜索引擎



savedomdocument ›

Since2.8.0
已弃用n/a
savedomdocument ( $doc, $filename )
参数: (2)
  • (DOMDocument) $doc
    Required: Yes
  • (string) $filename
    Required: Yes
定义在:
文档:

Saves the XML document into a file



源码

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 );
}