亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

創(chuàng)建一張表,用查詢構(gòu)造器中的CURD對(duì)其進(jìn)行操作

オリジナル 2019-03-04 06:32:02 285
サマリー:創(chuàng)建一張表,用查詢構(gòu)造器中的CURD對(duì)其進(jìn)行操作insert操作:public function insert(){  // 增加多條數(shù)據(jù)    $data=[      ['title'=>'Php從入門到放棄','price

創(chuàng)建一張表,用查詢構(gòu)造器中的CURD對(duì)其進(jìn)行操作

insert操作:

public function insert(){
 // 增加多條數(shù)據(jù)
   $data=[
     ['title'=>'Php從入門到放棄','price'=>35,'color'=>'紅','size'=>'中'],
     ['title'=>'Java從入門到放棄','price'=>55,'color'=>'黃','size'=>'小'],
     ['title'=>'Css從入門到放棄','price'=>64,'color'=>'青','size'=>'大'],
     ['title'=>'JavaScript從入門到放棄','price'=>23,'color'=>'綠','size'=>'中'],
     ['title'=>'Python從入門到放棄','price'=>65,'color'=>'藍(lán)','size'=>'中'],
     ['title'=>'C++從入門到放棄','price'=>123,'color'=>'紫','size'=>'小'],
     ['title'=>'C語言從入門到放棄','price'=>98,'color'=>'黑','size'=>'小'],
     ['title'=>'VB從入門到放棄','price'=>35,'color'=>'白','size'=>'大']
   ];
   $res=DB::table('shop')->data($data)->insertAll();
   return '成功增加了'.$res.'條數(shù)據(jù)';
}

insert.png

delete操作:

public function delete(){
   //刪除數(shù)據(jù)
   $res=DB::table('shop')->where('price','>=',50)->delete();
    return '成功刪除了'.$res.'條數(shù)據(jù)';
}

delete.png

Updata

public function update(){
    $res=DB::table('shop')
        ->where('size','中')
        ->data('size','小')
        ->update();
    return '成功修改了'.$res.'條數(shù)據(jù)';
}

updata.png


select查詢操作

public function find(){
    $res=DB::table('shop')
        ->field(['id,title'])
         ->where('price','>',20)
        ->select();
    dump($res);
    echo '成功查詢到了'.count($res).'條數(shù)據(jù)';
}public function find(){    $res=DB::table('shop')
        ->field(['id,title'])
         ->where('price','>',20)
        ->select();
    dump($res);
    echo '成功查詢到了'.count($res).'條數(shù)據(jù)';
}

select.png

添削の先生:查無此人添削時(shí)間:2019-03-04 09:13:06
先生のまとめ:完成的不錯(cuò)。 where('price','>=',50) where最好用數(shù)組。

手記を発表する

人気のある見出し語