Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“PHP清理”&$&引用;_Php_Html_Unicode - Fatal编程技术网

“PHP清理”&$&引用;

“PHP清理”&$&引用;,php,html,unicode,Php,Html,Unicode,我正在尝试将HTML转换为纯文本。我得到了很多&\#8217&\#8220等 我试过: html2text命令行 html\u实体解码+ENT\u引号ENT\u HTML401UTF-8 html\u实体解码(htmlentities($str)) strip_标签 trim 它确实对清理其他东西有很大帮助,但是那些&\-8217“不要修复。如何正确转换它们?您是否尝试过“htmlspecialchars\u解码” 你试过“htmlspecialchars\u解码”吗 你是说̵

我正在尝试将HTML转换为纯文本。我得到了很多
&\#8217
&\#8220

我试过:

  • html2text
    命令行
  • html\u实体解码
    +
    ENT\u引号
    ENT\u HTML401
    UTF-8
  • html\u实体解码(htmlentities($str))
  • strip_标签
  • trim
  • 它确实对清理其他东西有很大帮助,但是那些
    &\-8217
    不要修复。如何正确转换它们?

    您是否尝试过“htmlspecialchars\u解码”

    你试过“htmlspecialchars\u解码”吗

    你是说
    &&8220?你是说
    &&8220
    <?php
    $str = "<p>this -&gt; &quot;</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 -> &quot;</p>