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