按照 PHP 官网手册中网友提供的解决方法进行尝试,仍然不能解决问题,不知道是不是我本地 PHP 版本的问题。
解决方法一:
Please note that iconv('UTF-8', 'ASCII//TRANSLIT', ...) doesn't work properly when locale category LC_CTYPE is set to C or POSIX. You must choose another locale otherwise all non-ASCII characters will be replaced with question marks. This is at least true with glibc 2.5.
Example:
[翻译]
请注意 iconv 在语言环境类别 LC_CTYPE 类别设置为 C 或者 POSIX 时不能正常的工作。你必须选择另一个语言,否则所有的非 ASCLL 编码将被替换成问号"?"。这个问题在 glibc 2.5 以下是真实的。
举例如下: 解决方法二:
That will strip invalid characters from UTF-8 strings (so that you can insert it into a database, etc.). Instead of "none" you can also use the value 32 if you want it to insert spaces in place of the invalid characters. 阅(75)评(0)查看评论
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:php中文网