【发布时间】:2016-02-03 13:46:57
【问题描述】:
我正在尝试使用strip_tags 和trim 来检测字符串是否包含空html?
$description = '<p> </p>';
$output = trim(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')));
var_dump($output);
字符串'Â'(长度=2)
我的调试尝试解决这个问题:
$description = '<p> </p>';
$test = mb_detect_encoding($description);
$test .= "\n";
$test .= trim(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')));
$test .= "\n";
$test .= html_entity_decode($description, ENT_QUOTES, 'UTF-8');
file_put_contents('debug.txt', $test);
输出:debug.txt
ASCII
<p> </p>
【问题讨论】:
标签: php