Tidy tidy::diagnose

tidy_diagnose

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

tidy::diagnose -- tidy_diagnose — 구문 분석 및 복구된 마크업에 대해 구성된 진단 실행


설명

객체 지향 스타일

public tidy::diagnose(): bool

절차적 스타일

tidy_diagnose(tidy $tidy): bool

오류 버퍼에 문서에 대한 추가 정보를 추가하여 주어진 tidy tidy에 대한 진단 테스트를 실행합니다.


매개변수

tidy
Tidy 개체.

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


Examples

예제 #1 tidy::diagnose() 예제

                  
<?php

$html = <<< HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<p>paragraph</p>
HTML;

$tidy = tidy_parse_string($html);
$tidy->cleanRepair();

// note the difference between the two outputs
echo $tidy->errorBuffer . "\n";

$tidy->diagnose();
echo $tidy->errorBuffer;

?>
                  
                

위의 예는 다음을 출력합니다.

line 4 column 1 - Warning: <p> isn't allowed in <head> elements
line 4 column 1 - Warning: inserting missing 'title' element
line 4 column 1 - Warning: <p> isn't allowed in <head> elements
line 4 column 1 - Warning: inserting missing 'title' element
Info: Doctype given is "-//W3C//DTD XHTML 1.0 Strict//EN"
Info: Document content looks like XHTML 1.0 Strict
2 warnings, 0 errors were found!
                

기타

  • tidy::errorBuffer()