(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.7.0)
tidy::repairString -- tidy_repair_string — Répare une chaîne HTML en utilisant un fichier de configuration optionnel
Style orienté objet
$string, array|string|null $config = null, ?string $encoding = null): string|falseStyle procédural
$string, array|string|null $config = null, ?string $encoding = null): string|false
   Répare la chaîne data.
  
stringLes données à réparer.
config
       La configuration config peut être passée
       sous forme de tableau ou de chaîne de caractères. Si une chaîne de caractères est passée,
       elle est interprétée comme le nom du fichier de configuration,
       et sinon, elle est interprétée comme les options elles-mêmes.
      
Lisez » http://api.html-tidy.org/#quick-reference pour une explication sur chaque option.
encoding
       Le paramètre encoding configure l'encodage
       pour les documents d'entrée et de sortie. Les valeurs possibles sont
       ascii, latin0, latin1,
       raw, utf8, iso2022,
       mac, win1252, ibm858,
       utf16, utf16le, utf16be,
       big5 et shiftjis.
      
   Retourne la chaîne réparée,  ou false si une erreur survient.
  
| Version | Description | 
|---|---|
| 8.0.0 | tidy::repairString() est désormais une méthode statique. | 
| 8.0.0 | configetencodingsont désormais nullable. | 
| 8.0.0 | Cette fonction n'accepte plus le paramètre useIncludePath. | 
Exemple #1 Exemple avec tidy::repairString()
<?php
ob_start();
?>
<html>
 <head>
  <title>test</title>
 </head>
 <body>
  <p>error</i>
 </body>
</html>
<?php
$buffer = ob_get_clean();
$tidy = tidy_repair_string($buffer);
echo $tidy;
?>
L'exemple ci-dessus va afficher :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>test</title> </head> <body> <p>error</p> </body> </html>