2
我试图用strip_tags
和trim
来检测一个字符串是否包含空html?PHP的html_entity_decode和修剪混淆
$description = '<p> </p>';
$output = trim(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')));
var_dump($output);
字符串 'A'(长度= 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>
尸体解剖在这方面是一个很棒的词。 – Martin