PHP - Manual: Dom\HTMLDocument::createEmpty
2025-02-27
(PHP 8 >= 8.4.0)
Dom\HTMLDocument::createEmpty — Creates an empty HTML document
Creates an empty HTML document without any elements.
encoding
An empty HTML document.
示例 #1 Dom\HTMLDocument::createEmpty() example
Creates an empty document and serializes it.
<?php
$dom = Dom\HTMLDocument::createEmpty();
var_dump($dom->saveHtml());
?>
以上示例会输出:
string(0) ""
官方地址:https://www.php.net/manual/en/dom-htmldocument.createempty.php