Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将 HTML 转换为纯文本。我得到很多&\#8217; &\#8220;等等。
&\#8217;
&\#8220;
我努力了:
html2text
html_entity_decode
ENT_QUOTES
ENT_HTML401
UTF-8
html_entity_decode(htmlentities($str))
strip_tags
trim
它确实对清理其他东西有很大帮助,但这些东西&\#8217; “并没有得到修复。如何正确转换它们?
“
你试过“htmlspecialchars_decode”吗
<?php $str = "<p>this -> "</p>\n"; echo htmlspecialchars_decode($str); // note that here the quotes aren't converted echo htmlspecialchars_decode($str, ENT_NOQUOTES); ?>
上面的示例将输出:
<p>this -> "</p> <p>this -> "</p>