ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 删除数据 ## delete(); ## 语法: ## self::get(1)->delete(); 其中的1为主键id=1 ``` $res= self::get(1)->delete(); dump($res); ``` ## 语法: ## $this->where(‘键名’,'条件')->delete(); ``` $res= $this->where('id',2)->delete(); dump($res); ``` ## self::destroy语法: ``` $res= self::destroy([3,4,5]); //自增字段删除方法 dump($res); ``` ## self::destroy条件删除: ``` $res= self::destroy(['name'=>'guohao1']); dump($res); ``` 代码案例: ``` <?php namespace app\index\model; use think\Model; class Maik extends Model{ public function usenameinfo(){ $res= self::destroy(['name'=>'guohao1']); dump($res); } } ```