这个错误是字符编码的问题 , 因为内容里有可能有表情等特殊字符 , 需要使用utf8mb4编码
重点还有一个是 , 在php代码中连接上mysql后一定要执行一下 t name ut我心目中的春作文f8mb4 否则也是不行的
比如下面这个表的字符编码
create table laruence( id int unsigned auto_increment, title varchar(225) not null default '', link varchar(225) not null default '', content text, primary key id_idx(id), unique key link_idx(link))engine=innodb chart=utf8mb4;
比如下面的php代码:
$this->pdo = new \pdo($this->dsn, $this->us毕业典礼主持词er, $this->password,array( \pdo::attr_persistent => $this->persistent 兵车行赏析 安徽工业大学录取分数线 )); $this->pd茶叶属于什么行业o->tattribute( \pdo::attr_errmode,\pdo::errmode_exception); $this->pdo->exec("t names utf8mb4");
本文发布于:2023-04-08 11:22:56,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/c089d8181c68d6ae699c33d86aac381e.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:[PHP] 解决mysql下1366 Incorrect string value错误.doc
本文 PDF 下载地址:[PHP] 解决mysql下1366 Incorrect string value错误.pdf
留言与评论(共有 0 条评论) |