我使用str_replace来替换一些字符,出于某种原因,输出将单引号转换为&039.我根本不想取代单引号。是什么原因造成的?
$v = yourstring;
$newv = str_replace("&039", "'", $v);
示例:
$v = "Hi My Name Is &039George&039";
$newv = str_replace("&039", "'", $v);
echo $newv;
输出将是:
Hi My Name Is 'George'
现在我只希望这能有所帮助,我希望我能正确理解你的问题。
也许某种转换可能很有用:
$v = $_GET['value'];
$v1 = html_entity_decode($v);
您可以使用之类的东西将它们转换回
html_entity_decode(__("某些文本")、ENT_QUOTES、"UTF-8")