PHP Conference Japan 2024

tidy_error_count

(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)

tidy_error_count傳回指定文件中遇到的 Tidy 錯誤數量

說明

tidy_error_count(tidy $tidy): int

傳回指定文件中遇到的 Tidy 錯誤數量。

參數

tidy

Tidy 物件。

傳回值

傳回錯誤數量。

範例

範例 #1 tidy_error_count() 範例

<?php
$html
= '<p>test</i>
<bogustag>bogus</bogustag>'
;

$tidy = tidy_parse_string($html);

echo
tidy_error_count($tidy) . "\n"; //1

echo $tidy->errorBuffer;
?>

以上範例會輸出

1
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 8 - Warning: discarding unexpected </i>
line 2 column 1 - Error: <bogustag> is not recognized!
line 2 column 1 - Warning: discarding unexpected <bogustag>
line 2 column 16 - Warning: discarding unexpected </bogustag>
line 1 column 1 - Warning: inserting missing 'title' element

另請參閱

新增註解

使用者提供的註解

此頁面沒有使用者提供的註解。
To Top