我有一个html文件,我加载到
DOMDocument,其中我做了一些DOM操作输出html与
saveHTML.
问题是删除了输入标签后的空格,这里是HTML
window.jQuery || document.write(unescape('%3cscript src="/script/jquery.min.js"%3e%3c/script%3e'));
First name:
Last name:
Date of birth:
Address:
Phone number:
Sex:
Email address:
Account password:
PHP
$template_file = $_SERVER['DOCUMENT_ROOT']."/application/template/template.html";
$doc = new DOMDocument('1.0', 'utf-8');
$doc->loadHTMLFile($template_file);
/* dom manipulation, importing and appending nodes from other documents etc */
echo $doc->saveHTML();
除了< head>中的标签之外,它在我尝试的其他标签(< br>,< hr>)之后划分了空格.
我尝试将formatOutput设置为true,但只保留了结束标记之前的空格.
有没有办法让DOMDocument在我的< input>之后保留空格?