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

search for in the

tidy::root> <tidy::repairFile
[edit] Last updated: Fri, 17 May 2013

view this page in

tidy::repairString

tidy_repair_string

(PHP 5, PECL tidy >= 0.7.0)

tidy::repairString -- tidy_repair_stringSeçimlik bir yapılandırma dosyasını kullanarak bir dizgeyi onarır

Açıklama

Yordamsal kullanım

string tidy_repair_string ( string $veri [, mixed $ayarlar [, string $kodlama ]] )

Nesne yönelimli kullanım

string tidy::repairString ( string $veri [, mixed $ayarlar [, string $kodlama ]] )

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 ayarlar ve kodlama değiştirgeleri Tidy 2.0'da eklendi.

Ayrıca Bakınız



add a note add a note User Contributed Notes tidy::repairString - [2 notes]
up
0
dan-dot-hunsaker-at-gmail-dot-com
1 year ago
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.
up
0
gnuffo1 at gmail dot com
2 years ago
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
));
?>

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