我有一个带有智能引号和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);