php8.5
Home/ Manual/ tidy / tidy/ tidy::body

tidy::body

PHP function Edit on GitHub ✎

Returns a tidyNode object starting from the <body> tag of the tidy parse tree

Description

Oop

tidy::body(): tidyNode|null

Procedural

tidy_get_body(tidy $tidy): tidyNode|null

Returns a tidyNode object starting from the <body> tag of the tidy parse tree.

Parameters

tidy

Object

Return Values

Returns a tidyNode object starting from the <body> tag of the tidy parse tree.

Examples

tidy::getBody() example

php
<?php
$html = '
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <p>paragraph</p>
  </body>
</html>';

$tidy = tidy_parse_string($html);

$body = $tidy->Body();
echo $body->value;
?>

The above example will output:

output
<body>
<p>paragraph</p>
</body>

See Also

Source: reference/tidy/tidy/body.xml · from the official PHP manual (php/doc-en)