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