我正在尝试使用无重音函数来删除特殊字符。
如果put: echo Unaccent('áéç');结果是ok的
有什么建议吗?
$fiche = file('fiches.txt');
foreach ($fiche as $line_num => $line) {
echo $line;
$foo = explode (",", $line);
function Unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
echo Unaccent($foo[1]);发布于 2013-03-19 00:38:35
我是这样解决的:
preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($line));非常感谢大家。
https://stackoverflow.com/questions/15480841
复制相似问题