スマート クォートと emdash を含む文字列があります。他の特殊文字を削除したくありません。この2つだけを削除したいだけです。いくつかの場所に表示したいが、他の場所には表示したくない.いくつかの解決策を試してみたが、何もうまくいかなかった. どのように進めればよいですか?これらは私が試したオプションです...
$pullquoteWithapos = utf8_encode($title);
$pullquoteWithapos =utf8_decode(str_replace('”','',$pullquoteWithapos));
$pullquoteWithapos = utf8_decode($pullquoteWithapos);
$pullquoteWithapos = str_replace('?', '\'',$pullquoteWithapos);
echo $pullquoteWithapos;
ティア
これは私がやったことです $cleanStr = htmlentities($str, ENT_QUOTES, 'UTF-8'); $cleanStr = str_replace('”','',$cleanStr); $cleanStr = str_replace('—','-',$cleanStr); $cleanStr = str_replace(''','\'', $cleanStr);