拆卸/更换”来自字符串


Removing/Replacing ” from string

可能重复:
如何在PHP 中解码数字HTML实体

如何删除/替换字符串中的”字符?

我试过html_entity_decode,但似乎不起作用。字符串中还有其他类似的字符似乎没有被转换或删除。

有什么想法吗?

问题是html_entity_decode()不能转换数字实体。

我为建议的重复添加了一个答案如何在PHP 中解码数字HTML实体

str_replace(array('”', '”'), '', $thestring);

以下是一个工作示例:http://codepad.org/gXrZcxaF

这能满足您的需求吗:

  • http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php使用PHP转换智能引号和其他字符,使其正确显示
  • http://ca2.php.net/manual/en/function.htmlentities.php#84612在PHP中处理数字实体(对手册的评论)