SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F...' for column 'content' at r
- 作者:小编
- 发表时间:2023-09-05 16:04
- 来源:
![SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图1) SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图1)](http://www.eyoucms.com/uploads/allimg/20220427/1008-22042F91U9E2.png)
类似这样的报错提示,一般是内容详情的字段不支持来自微信公众号等文章的特殊表情、符号等导致。
原因是易优cms的数据库配置里的编码默认采用utf8,要改成 utf8mb4 ,以及内容详情字段也要改成 utf8mb4编码类型才行。
解决教程:
步骤1、编辑数据库配置文件 application/database.php
![SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图2) SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图2)](http://www.eyoucms.com/uploads/allimg/20220427/1008-22042F92452Q9.png)
步骤2、执行数据库sql语句,将内容字段 content 的字符集编码也改成 utf8mb4、排序规则:utf8mb4_general_ci,工具效果图如下:
![SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图3) SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图3)](http://www.eyoucms.com/uploads/allimg/20220427/1008-22042F92ID09.png)
如果没有不懂用工具,可以下载sql压缩包,解压将里面的sql文件,在【易优系统助手】插件里执行。
![SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图5) SQLSTATE[HY000]: General error: 1366 Incorrect string value: \xF0\x9F... for column content at r(图5)](http://www.eyoucms.com/uploads/allimg/20220427/1008-22042G02150S8.png)
合作
咨询
建站咨询