User::destroy(1);
// 支持批量删除多个数据
User::destroy('1,2,3');
// 或者
User::destroy([1,2,3]);
但是当
User::destroy([1]); 也就是数组只有一个值时候 删除报错。
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '1'' at line 1
生成的 SQL 语句
SELECT * FROM `thinkphp_role` WHERE = '1'
最佳答案