The docs referenced at http://tidy.sourceforge.net/docs/quickref.html above state that the configuration option 'sort-attributes' is an enumeration of 'none' and 'alpha', thereby specifying that strings of either form are the acceptable values. This may not be the case, however - on my system, the option was not honored until I set it to true. This may also be the case with other options, so experiment a bit. The output of tidy::getConfig() may be useful in this regard.
tidy::repairString
tidy_repair_string
(PHP 5, PECL tidy >= 0.7.0)
tidy::repairString -- tidy_repair_string — Seçimlik bir yapılandırma dosyasını kullanarak bir dizgeyi onarır
Açıklama
Yordamsal kullanım
Nesne yönelimli kullanım
Belirtilen veri dizgesini onarır.
Değiştirgeler
-
veri -
Onarılacak veri.
-
ayarlar -
Bir dizge veya bir dizi olarak belirtilebilir. Dizge verildiği takdirde yapılandırma dosyasının ismi olarak ele alınır. Dizi olarak verildiğinde ise dizinin yapılandırma seçeneklerini içerdiği varsayılır.
Seçeneklerin açıklamaları için » http://tidy.sourceforge.net/docs/quickref.html adresine bakınız.
-
kodlama -
Belge girdi çıktı kodlaması belirtilir. Olası değerler: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5 ve shiftjis.
Dönen Değerler
Onarılan dizge.
Örnekler
Örnek 1 - tidy::repairString() örneği
<?php
ob_start();
?>
<html>
<head>
<title>deneme</title>
</head>
<body>
<p>hata</i>
</body>
</html>
<?php
$buffer = ob_get_clean();
$tidy = new tidy();
$clean = $tidy->repairString($buffer);
echo $clean;
?>
Yukarıdaki örneğin çıktısı:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>deneme</title> </head> <body> <p>hata</p> </body> </html>
Notlar
Bilginize: Seçimlik
ayarlarvekodlamadeğiştirgeleri Tidy 2.0'da eklendi.
Ayrıca Bakınız
- tidy::parseFile() - Belirtilen URI veya dosyadaki imlenimi çözümler
- tidy::parseString() - Bir dizge olarak belirtilen bir belgeyi çözümler
- tidy::repairFile() - Bir dosyayı onarıp bir dizge olarak döndürür
You can also use this function to repair xml, for example if stray ampersands etc are breaking it:
<?php
$xml = tidy_repair_string($xml, array(
'output-xml' => true,
'input-xml' => true
));
?>
