php整洁无中断空间



我有一个html,里面有一些特殊的html字符,比如 。。。但整洁地使该字符的CCD_ 2成为空间。

// 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);

必须设置或更改what's选项。

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

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

裸顶类型:布尔默认值:无示例:y/n,yes/no,t/f,真/假,1/0
此选项指定Tidy是否应剥离MicrosoftWord 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(false)是我尝试过的东西,但它对输出(在本例中)

没有任何影响

最新更新