整洁不关闭
标签
问题描述:
我试图用整齐的功能,清理不具有关闭</hr>
标记的HTML字符串:整洁不关闭<hr>标签
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
然而,当我用下面几行:
$tidy = tidy_parse_string($data);
tidy_clean_repair($tidy);
echo ($tidy);
的</hr>
标签不被加入,输出:
<html>
<head>
<title>301 Moved Permanently</title>
</head>
<body bgcolor='white'>
<center>
<h1>301 Moved Permanently</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html>
整洁的图书馆只是不能关闭<hr>
标签,或者我错过了什么?
你是什么意思你要'
'拥有'',它是一个void元素,它不需要关闭 – Ghost
那么当我尝试从unclosed字符串中创建SimpleXMLElement时,出现错误,但是当它关闭时没有错误。这就是为什么我需要它关闭。 – MarksCode
然后使用不太严格的'DOMDocument' – Ghost