Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: tidy_get_root - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

tidy_get_status" width="11" height="7"/> <tidy_get_release
Last updated: Mon, 05 Feb 2007

view this page in

tidy_get_root

(PHP 5)

tidy_get_root — Tidy パースツリーのルートを表す tidyNode を返す

説明

手続き言語型スタイル:

tidyNode tidy_get_root ( tidy object )

オブジェクト指向言語型スタイル:

tidyNode tidy->root ( void )

Tidy パースツリーのルートを表す tidyNode を返します。

例 2369. ノードをダンプする

<?php

$html
= <<< HTML
<html><body>

<p>paragraph</p>
<br/>

</body></html>
HTML;

$tidy = tidy_parse_string($html);
dump_nodes($tidy->root(), 1);


function
dump_nodes($node, $indent) {

   if(
$node->hasChildren()) {
       foreach(
$node->child as $child) {
           echo
str_repeat('.', $indent*2) . ($child->name ? $child->name : '"'.$child->value.'"'). "\n";

          
dump_nodes($child, $indent+1);
       }
   }
}
?>

上の例の出力は以下となります。


..html
....head
......title
....body
......p
........"paragraph"
......br

      

注意: この関数は、Zend Engine 2、つまり、PHP >= 5.0.0でのみ利用可能です。



add a note add a note User Contributed Notes
tidy_get_root
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites