2012-07-31 60 views
1

我有一个html的一些特殊的html字符,如  ...但整洁使这个字符作为空间。php tidy没有休息空间

// tidy config 
$tidyConfig = array(
    'indent' => true, 
    'output-xhtml' => true, 
    'input-encoding' => 'utf8', 
    'output-encoding' => 'utf8', 
    'show-body-only' => true, 
    'fix-backslash' => true, 
    'quote-marks' => true, 
    'wrap' => 1024, 
); 

// tidy up 
$string = (string)tidy_parse_string($string, $tidyConfig); 

必须设置或更改什么选项。

结果http://codepad.viper-7.com/bsqD0n

+1

你尝试,你之前用空间代替' '运行'tidy'? – Peon 2012-07-31 10:48:39

+0

@DainisAbols有什么更好的方法来整理? – sweb 2012-07-31 10:54:38

+0

检查你的输入编码:它确实是utf-8吗? – madflow 2012-07-31 11:21:55

回答

1

这个怎么样? http://codepad.viper-7.com/B5PDFc

裸顶部类型:Boolean默认值:无实施例:Y/N,是/否,T/F, 真/假,1/0
此选项指定如果整理应剥去微软 特定来自Word 2000文档的HTML和输出空格而不是 输入空间

$string = 'word word   word'; 

// tidy config 
$tidyConfig = array(
    'indent' => true, 
    'output-xhtml' => false, 
    'input-encoding' => 'utf8', 
    'output-encoding' => 'utf8', 
    'show-body-only' =>true, 
    'fix-backslash' => true, 
    'quote-marks' => true, 
    'wrap' => 1024, 
    'bare' => true, 
); 

// tidy up 
var_dump((string)tidy_parse_string($string, $tidyConfig)); 

*输出的XHTML(假)是我试验过,但它使有关输出无差异(在这种情况下)