第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

輕松學(xué)會Laravel-基礎(chǔ)篇

難度中級
時長 2小時32分
學(xué)習(xí)人數(shù)
綜合評分9.63
188人評價 查看評價
9.9 內(nèi)容實用
9.6 簡潔易懂
9.4 邏輯清晰
  • php的orm關(guān)聯(lián)table

    查看全部
  • 查詢構(gòu)造器中的聚合函數(shù)

    count()????max()????min()????avg()????sum()

    DB::table('student')->count();????//總條數(shù)

    DB::table('student')->max('age');????//最大值

    DB::table('student')->min('age');????//最小值

    DB::table('student')->avg('age');????//平均值

    DB::table('student')->sum('age');????//總和


    查看全部
  • 查詢構(gòu)造器查詢數(shù)據(jù)方法

    get()????first()????where()????pluck()? ? lists()????select()?? ? chunk()

    orderBy('id','desc')????這個是排序方法 ?desc是降敘 ? ? asce升序

    whereRaw() 添加個條件whereRaw('id>=? and age >?',[1001,18])

    $students = DB::table('student')->get();????//返回所有數(shù)據(jù)

    $students = DB::table('student')->first();????//返回首條數(shù)據(jù),一條數(shù)據(jù)

    $students = DB::table('student')->where('id','>=',10)->get();//單個條件

    $students = DB::table('student')->whereRaw('id>=? and age >?',[1001,18])->get();//多條件

    $students = DB::table('student')->pluck('字段');????//只返回某一字段的值

    $students = DB::table('student')->lists('字段');????//返回某一字段的值 ?與pluck區(qū)別在與可以指定下標(biāo)如lists('字段','下標(biāo)的字段');

    $students = DB::table('student')->select('字段','字段')->get();//查詢的字段

    DB::table('student')->chunk(2,function($studnets){

    ????var_dump($students);

    }); ? //每次查詢的幾條數(shù)據(jù) 顯示

    查看全部
  • 查詢構(gòu)造器刪除數(shù)據(jù)

    $num = DB::('student')->delete(); ? //刪除所有數(shù)據(jù)

    $num = DB::('student')->where('id',15)->delete();//刪除指定id的數(shù)據(jù)

    $num = DB::('student')->where('id,'>=',12)->delete();//條件刪除

    DB::table('student')->truncate(); ?//清空數(shù)據(jù)表,沒有返回值

    查看全部
  • 更新字段

    $num = DB::table('表名')->where('id',12)->update(['age'=>30]);

    自增

    $num = DB::table('表名')->increment('age',增加的數(shù)值,默認(rèn)是1);

    自減

    $num = DB::table('表名')->decrement('age',自減默認(rèn)是1);

    在實現(xiàn)自增和自減的同時修改其他的字段修改條件添加

    $num = DB::table('表名')->where('id',12)->decrement('age',自減默認(rèn)是1,['name'=>'imooc');

    查看全部
  • 查詢構(gòu)造器***

    1、查詢構(gòu)造器簡

    查詢構(gòu)造器提供方便,流暢的接口,簡歷及執(zhí)行數(shù)據(jù)庫查找語法

    PDO參數(shù)綁定,保護(hù)程序面SQL注入,傳入?yún)?shù)不需要轉(zhuǎn)義字符

    在所有支持的數(shù)據(jù)庫系統(tǒng)上都可以執(zhí)行

    查詢構(gòu)造器插入方法:

    1、$bool = DB::table('需要查詢的表')->insert(['字段1'=>'值','字段2'=>'值']); ?//插入一條數(shù)據(jù),返回值是bool值

    2、$id = DB::table('需要查詢的表')->insertGetId(['字段1'=>'值','字段2'=>'值']); ? //插入一條數(shù)據(jù),返回的插入的ID ? insertGetId

    3、$bool = DB::table('需要查詢的表')->insert([

    ????????????['字段1'=>'值','字段2'=>'值'],

    ????????????['字段1'=>'值','字段2'=>'值']

    ]); //添加中括號,以數(shù)組的形式插入就可以插入多條數(shù)據(jù)了





    查看全部
  • Laravel框架哥哥版本對PHP的要求

    5.1 5.2????php5.5.9+

    4.2????????? php5.4+

    4.1????????? ?php5.3.7+

    查看全部
  • 連接數(shù)據(jù)庫

    配置文件:/config/database.php

    'database'=>env('DB_DATABASE','forge')

    env 對應(yīng)的是 /.env文件配置

    查看全部
  • Eloquent ORM 使用方法

    1、數(shù)據(jù)庫的配置文件在\config\database.php文件中

    .env 表中可以更改一下數(shù)據(jù)庫的連接

    1、模型建立

    <?php

    namespace App;

    use Illuminate\Database\Eloquent\Model;

    class Student extends Model

    {

    ????//指定表名?

    ????protected $table = 'student';

    ????//指定 主鍵?

    ????protected $primaryKey = 'id';

    }


    2、使用 ORM的方方法

    Student::all(); ? //查詢?nèi)?/p>

    Student::find('id'); ?//查詢一條ID的記錄

    Student::findeorFail('id') //查詢Id 查詢不到報錯

    Student::get(); ? ?//查詢構(gòu)造器全部

    Student ::where('id','條件',' 數(shù)據(jù)')

    ????????????????->orderBy('age','desc')

    ????????????????->first()

    Student::chunk(查詢條數(shù),function($studnets){

    ????var_dump($students);

    });

    //聚合函數(shù)

    Student::count(); ?//總共多少條數(shù)據(jù)

    Student::where('id','>',1001)->max('age');

    查看全部
  • 查詢構(gòu)造器

    https://img1.sycdn.imooc.com//5b3379a60001074912710655.jpg


    查看全部
  • 流程控制:

    查看全部
    0 采集 收起 來源:流程控制

    2018-06-20

  • 流程控制:


    查看全部
    0 采集 收起 來源:流程控制

    2018-06-20

  • 模板中的注釋:

    {{-- 注釋的內(nèi)容 --}}

    {{--? --}}中的注釋在html中看不到

    查看全部
  • 模板中原樣輸出 - 在輸出內(nèi)容前面加@符號

    查看全部
  • 模板中使用PHP代碼:

    查看全部

舉報

0/150
提交
取消
課程須知
1、掌握基本的HTML相關(guān)知識 2、熟悉PHP語言,了解面向?qū)ο蟆⒚臻g、Traits等特性 3、熟悉關(guān)系型數(shù)據(jù)庫Mysql,了解數(shù)據(jù)庫的表、記錄、列等概念。
老師告訴你能學(xué)到什么?
1、了解Laravel的優(yōu)勢 2、快速搭建Laravel開發(fā)環(huán)境 3、掌握Laravel中的路由和MVC 4、掌握Laravel中的數(shù)據(jù)庫操作 5、掌握Laravel中的模板引擎

微信掃碼,參與3人拼團(tuán)

微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!