我正在尝试去除弯曲的撇号(我想是从某种富文本文档中复制粘贴的),但似乎遇到了障碍。下面的代码对我无效。
$word = "Today’s";
$search = array('„', '“', '’');
$replace = array('"', '"', "'");
$word = str_replace($search, $replace, htmlentities($word, ENT_QUOTES));
What I end up with is $word containing 'Today’s'.
当我从我的$search数组中移除&符号时,替换发生了,但是,显然这样做是不能完成任务的,因为&符号仍留在字符串中。为什么str_replace在遇到&符号时失败了呢?