国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

查詢構(gòu)造器的CURD

Original 2019-04-05 22:13:32 156
abstract:?phpnamespace Home\Controller;use Think\Controller;class FormController extends Controller{public function insert(){$Form = D('Form');if($Form->create()) {$result = $Form->add();if($resu

?php

namespace Home\Controller;

use Think\Controller;

class FormController extends Controller{

public function insert(){

$Form = D('Form');

if($Form->create()) {

$result = $Form->add();

if($result) {

$this->success('數(shù)據(jù)添加成功!');

}else{

$this->error('數(shù)據(jù)添加錯(cuò)誤!');

}

}else{

$this->error($Form->getError());

}

}

}

如果主鍵是自增類型的話,add方法的返回值就是該主鍵的值。不是自增主鍵的話,返回值表示插入數(shù)據(jù)的個(gè)數(shù)。如果返回false則表示寫入出錯(cuò)。



Correcting teacher:西門大官人Correction time:2019-04-08 10:17:21
Teacher's summary:數(shù)據(jù)寫入理解的很好。糾正一下,如果主鍵是自增類型(不要求一定要自增,是主鍵就行)的話,add方法的返回值就是該主鍵的值

Release Notes

Popular Entries