PHP yapılır HTML Doğrulama için, tidy extension sadece istediğiniz ne olabilir:
Tidy is a binding for the Tidy HTML
clean and repair utility which allows
you to not only clean and otherwise
manipulate HTML documents, but also
traverse the document tree
tidy::__construct verilen örnek şöyle:
$html = <<< HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>title</title></head>
<body>
<p>paragraph <bt />
text</p>
</body></html>
HTML;
$tidy = new tidy();
$tidy->ParseString($html);
$tidy->CleanRepair();
if ($tidy->errorBuffer) {
var_dump($tidy->errorBuffer);
}
Ve bu çıkış veriyor:
string 'line 8 column 14 - Error: <bt> is not recognized!
line 8 column 14 - Warning: discarding unexpected <bt>' (length=104)
Bir çift ya da diğer yöntemler de, btw ilginç görünüyor ;-)
Note you need to have this extension installed / enabled on your webserver, though -- there should be a "tidy" section in the output of phpinfo()
.