当前位置: 首页 > 工具软件 > HTML Tidy > 使用案例 >

使用html tidy转换出现error:can't open"",Html tidy

闻人嘉颖
2023-12-01

Yep, looks like tidy for php4 is significantly different than for php5. Here's my test code:

ob_start();

echo '

';

print_r(get_loaded_extensions());

print_r(get_extension_funcs('tidy'));

echo '

';

$out1 = ob_get_contents();

ob_end_clean();

$html = '

' . $out1 . '';

$config = array('indent'=> TRUE,

'output-xhtml' => TRUE,

'wrap' => 80);

tidy_set_encoding('UTF8');

foreach ($config as $key => $value) {

tidy_setopt($key,$value);

}

tidy_parse_string($html);

tidy_clean_repair();

echo tidy_get_output();

?>

which gave me usable xhtml:

/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 
 

Array

(

[0] => standard

[1] => openssl

[2] => apache

[3] => bz2

[4] => ctype

[5] => curl

[6] => ftp

[7] => gd

[8] => mcrypt

[9] => mhash

[10] => mysql

[11] => overload

[12] => pcre

[13] => pdf

[14] => posix

[15] => session

[16] => tokenizer

[17] => xml

[18] => xslt

[19] => zlib

[20] => tidy

)

Array

(

[0] => tidy_setopt

[1] => tidy_getopt

[2] => tidy_parse_string

[3] => tidy_parse_file

[4] => tidy_get_output

[5] => tidy_get_error_buffer

[6] => tidy_clean_repair

[7] => tidy_repair_string

[8] => tidy_repair_file

[9] => tidy_diagnose

[10] => tidy_get_release

[11] => tidy_get_config

[12] => tidy_get_status

[13] => tidy_get_html_ver

[14] => tidy_is_xhtml

[15] => tidy_is_xml

[16] => tidy_error_count

[17] => tidy_warning_count

[18] => tidy_access_count

[19] => tidy_config_count

[20] => tidy_load_config

[21] => tidy_load_config_enc

[22] => tidy_set_encoding

[23] => tidy_save_config

)

So I suppose this means that I'm tough out of luck with this module until my ISP is forced to upgrade to PHP5 sometime in 2008 when official support runs dry (not sure they'll do it even then, I just don't know). Maybe by then I'll be experienced enough to backfill php4 tidy support myself. heh.

 类似资料: