如何在PHP中删除智能引用和emdash并用空格和常规短划线替换它们?

时间:2016-01-25 19:30:53

标签: php html-entities smart-quotes

我有一个带有智能引号和emdash的字符串。我不想删除任何其他特殊字符。我只想删除这两个。我希望它能在某些地方展示,但不能在其他地方展示。有几个解决方案,但没有任何效果。我该怎么办? 这些是我试过的选项......

$pullquoteWithapos = utf8_encode($title);
$pullquoteWithapos =utf8_decode(str_replace('”','',$pullquoteWithapos));
$pullquoteWithapos = utf8_decode($pullquoteWithapos);
$pullquoteWithapos = str_replace('?', '\'',$pullquoteWithapos);
echo $pullquoteWithapos;

TIA

这就是我所做的工作     $ cleanStr = htmlentities($ str,ENT_QUOTES,'UTF-8');     $ cleanStr = str_replace('“','',$ cleanStr);     $ cleanStr = str_replace(' - ',' - ',$ cleanStr);     $ cleanStr = str_replace(''','\'',$ cleanStr);

0 个答案:

没有答案