laravel报错:SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' (SQL: insert into `cart` (`uid`, `gid`, `gname`, `price`) values (3, 21, 夏季日系复古工装短袖衬衫男士印花潮流宽松五分

原因:要操作的数据表id没有设置自增,导致出现id为0的情况

解决方法:给该数据表的id字段设置自增

每天进步一点点
原文地址:https://www.cnblogs.com/youantianqin/p/10815950.html