{"id":6723,"date":"2024-07-30T12:01:04","date_gmt":"2024-07-30T04:01:04","guid":{"rendered":""},"modified":"2024-07-30T12:01:04","modified_gmt":"2024-07-30T04:01:04","slug":"tidy\u4f7f\u7528\u7b80\u4ecb_Tile\u8f6f\u4ef6\u662f\u5e72\u561b\u7684","status":"publish","type":"post","link":"https:\/\/mushiming.com\/6723.html","title":{"rendered":"tidy\u4f7f\u7528\u7b80\u4ecb_Tile\u8f6f\u4ef6\u662f\u5e72\u561b\u7684"},"content":{"rendered":"
\n
\n tidy\u4f7f\u7528\u7b80\u4ecb (2006-06-09 11:40)\n <\/div>\n
\n \u5206\u7c7b\uff1a  \u6280\u672f\u6587\u6863\n <\/div>\n
\n

\n

Tidy is a binding for the Tidy HTML clean and repair utility
Tidy\u662f\u4e00\u79cd\u6574\u7406\u548c\u4fee\u590d\u4f60\u7684HTML\u7684\u5de5\u5177,\u652f\u6301\u9762\u5411\u5bf9\u8c61\u6216\u9762\u5411\u8fc7\u7a0b\u65b9\u5f0f\u8c03\u7528,\u4e0b\u9762\u7b80\u5355\u8bf4\u8bf4\u5b83\u7684\u7528\u6cd5:
1)\u5bf9\u8c61\u65b9\u5f0f<\/p>\n

<?php
$html = '<p>test<\/I>'; \/\/\u8981\u5904\u7406\u7684\u5b57\u4e32
$tidy = new tidy;
$tidy->parseString($html);
$tidy->CleanRepair();
echo tidy_get_output($tidy); \/\/\u8f93\u51fa\u5904\u7406\u540e\u7684\u7ed3\u679c
?><\/span><\/strong><\/p>\n

2)\u8fc7\u7a0b\u65b9\u5f0f<\/p>\n

<?php
$html =\" <p>error<br>another line<\/i>\";
$config = array('indent' => TRUE,
                'output-xhtml' => TRUE,
                'wrap' => 200);
$tidy = tidy_parse_string($buffer, $config, 'UTF8'); \/\/\u8fd4\u56de\u7684\u662ftidy\u5bf9\u8c61
$tidy->CleanRepair($tidy);
echo tidy_get_output($tidy); \/\/\u8f93\u51fa\u5904\u7406\u540e\u7684\u7ed3\u679c
?><\/span><\/strong><\/p>\n

<?php
$html =\" <p>error<br>another line<\/i>\";
$config = array('indent' => TRUE,
                'output-xhtml' => TRUE,
                'wrap' => 200);
$tidy = tidy_repair_string($html, $config, 'UTF8'); \/\/\u8fd4\u56de\u7684\u662ftidy\u5bf9\u8c61
echo $tidy;
?><\/span><\/strong><\/p>\n

\u5176\u5b83\u51fd\u6570:
tidy tidy_parse_file \/\/\u9700\u8981\u7528tidy_get_X\u7cfb\u5217\u5904\u7406\u8fd4\u56de
String tidy_repair_file  \/\/\u53ef\u4ee5\u76f4\u63a5echo
tidy tidy_parse_string
String tidy_repair_string
\u5982\u679c\u4f60\u9700\u8981\u5355\u72ec\u5904\u7406HTML\u5185\u5bb9\u7684\u67d0\u4e9b\u6307\u5b9a\u6807\u8bb0,\u9700\u8981\u7528tidy_parse_*\u914d\u5408tidy_clean_repair\u4f7f\u7528,\u5e76\u4f7f\u7528tidy_get_*\u7cfb\u5217\u8f93\u51fa\u7ed3\u679c(tidy_get_*\u63a5\u53d7\u7684\u53c2\u6570\u4e3atidy\u5bf9\u8c61)
\u5982\u679c\u53ea\u662f\u5bf9\u6574\u4e2a\u5185\u5bb9\u7b80\u5355\u5904\u7406\u5e76\u8f93\u51fa,\u76f4\u63a5\u7528tidy_repair_*\u5904\u7406\u5e76\u8fd4\u56de\u7ed3\u679c\u5b57\u4e32,\u518decho\u5c31\u53ef\u4ee5\u4e86<\/p>\n

tidy_get_body  \/\/\u8fd4\u56debody\u6807\u8bb0\u90e8\u5206
tidy_get_config \/\/\u8fd4\u56de\u53c2\u6570\u914d\u7f6e ,\u5177\u4f53\u914d\u7f6e\u8bf7\u53c2\u9605http:\/\/tidy.sourceforge.net\/docs\/quickref.html
tidy_get_head \/\/head\u6807\u8bb0\u90e8\u5206
tidy_get_html \/\/html\u90e8\u5206(\u5168\u6587?)<\/p>\n

\n <\/div>\n

\n<\/p><\/div>\n<\/div>\n

\n
\n \u535a\u5ba2\u63a8\u8350\u6587\u7ae0\n <\/div>\n
    \n
  • \u6df1\u5c42\u6b21\u63a2\u8ba8mutex\u4e0esemaphore\u4e4b\u95f4\u7684\u533a\u522b(\u4e0b) (10\u5206\u949f\u524d)<\/li>\n
  • \u6df1\u5c42\u6b21\u63a2\u8ba8mutex\u4e0esemaphore\u4e4b\u95f4\u7684\u533a\u522b(\u4e2d) (11\u5206\u949f\u524d)<\/li>\n
  • \u6df1\u5c42\u6b21\u63a2\u8ba8mutex\u4e0esemaphore\u4e4b\u95f4\u7684\u533a\u522b(\u4e0a) (11\u5206\u949f\u524d)<\/li>\n
  • \u5173\u4e8ecopy_from_user\u51fd\u6570 (12\u5206\u949f\u524d)<\/li>\n
  • \u5173\u4e8etasklet\u7684\u4e00\u70b9\u5c0f\u5c0f\u7684\u89e3\u91ca (12\u5206\u949f\u524d)<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"tidy\u4f7f\u7528\u7b80\u4ecb_Tile\u8f6f\u4ef6\u662f\u5e72\u561b\u7684tidy\u4f7f\u7528\u7b80\u4ecb(2006-06-0911:40)\u5206\u7c7b\uff1a\u6280\u672f\u6587\u6863TidyisabindingfortheTidyHTMLcleanandrepairuti...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6723"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=6723"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6723\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=6723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=6723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=6723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}