<?php


namespace app\index\controller;

use app\index\model\Blog;
//模型是和一张数据表绑定的
class Demo6
{
    public function get()
    {
        //dump(Blog::get(3));
        //用查询构造器创建更加复杂的查询
        $res=Blog::field('id,name,title')
            ->where('id',1)
            ->find();
        dump($res);
        //Db::table('student')===Blog::

    }
    public function all()
    {
//        dump(Blog::all([1,2,3]));
        $res=Blog::field('id,name,title')
            ->where('id','in','1,2,3,4')
            ->select();
        dump($res);
    }
}
<?php


namespace app\index\model;

use think\Model;
class Blog extends Model
{

}
11-20 01:56