Loving Coding & Visual Design

PHP出错:json_encode: Invalid UTF-8 sequence in argument

json打包出错:

json_encode(): Invalid UTF-8 sequence in argument

解决办法:检测非法UTF8

mb_check_encoding($strs,'UTF-8')

然后

mb_convert_encoding($strs,'UTF-8','UTF-8');

即可保证不会出现Invalid UTF-8的错误,但是可能结果字符串中会有问号等乱码。



下一页


最 近 文 章

  1. 把reactjs升级到15.5.4 - 2017-05-24T15:04:15.880Z
  2. 关于SSL证书 - 2017-05-03T16:40:33.137Z
  3. 关于小朋友和游戏 - 2017-04-09T08:38:25.592Z
  4. 小程序不全面自由开放只有死路一条 - 2017-03-29T14:49:25.034Z
  5. Xcode6.3出错NSString is not implicitly convertible to String - Tue, 14 Apr 2015 14:37:47 +0000
  6. Jquery Ajax Parsererror: Unexpected end of input - Fri, 10 Apr 2015 05:43:22 +0000
  7. To Anyone Wanna Buy My Domains - Mon, 23 Mar 2015 15:41:22 +0000
  8. PHP出错:json_encode: Invalid UTF-8 sequence in argument - Thu, 19 Mar 2015 15:55:52 +0000
  9. spmjs运行构建命令出错 - Fri, 06 Mar 2015 07:35:56 +0000
  10. 再次把博客移回国内 - Thu, 29 Jan 2015 14:25:34 +0000