Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Yii 活动记录编写此命令
INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=c+1;
$model->Yourmodel::model()->findByPk($key); if($model){ $model->value = $newvalue; }else{ $model = new Yourmodel(); $model->value = $newvalue; } if($model->save()){ // do somethings }