TP5和TP3.2的使用區別


模板標簽不一樣:

TP5 可在配置文件中自行定義自己喜歡的標簽

TP5  使用雙標簽 如:{foreach} {/foreach}

    TP3 : <>

    TP5 :{}

調用數據表方式:

    M('User')->where(['name'=>'thinkphp'])->find();(3.2)

    db('User')->where('name'=>'thinkphp')->find();(5.0)

    M->db

實例化模型的方式:

    D('User')->where(['name'=>'thinkphp'])->find();

    model('User')->where(['name'=>'thinkphp'])->find();

或者

    $UserModel =new User();

    $UserModel->where(['name'=>'thinkphp'])->find();

    D->model

U方法:

    U->url

    IS_Get->Request::instance()->isGet();

    IS_POST->Request::instance()->isPost();

I方法

    I->input(代替);

C方法

    C->config()

具體查看助手函數:

https://www.kancloud.cn/manual/thinkphp5/144731

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM