PHP 将特殊字符转换为正常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 将特殊字符转换为正常相关的知识,希望对你有一定的参考价值。

$ts = array("/[À-Å]/","/Æ/","/Ç/","/[È-Ë]/","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/");
$tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y");
preg_replace($ts,$tn, $p);

以上是关于PHP 将特殊字符转换为正常的主要内容,如果未能解决你的问题,请参考以下文章

浅析PHP中处理HTML特殊字符转换

将特殊字符转换为 HTML 字符代码

删除 PHP 中可以从其他 textEditor 输入的特殊字符

php如何将json对象转字符串

HTML中的 · — “ 这种代码是啥? VB中怎么转换为正常显示?

在占位符 JSX 中渲染特殊字符