BFWSOA Model层的常用操作写法

Model层的常用操作写法

1、增加

Model_Albart::getInstance()->Insert([
                    'articleid' => 1,
                    'uid' =>2,
                    "albumid" => 3
                ]);

2、修改

Model_Albart::getInstance()->Update([
                    'id' =>1,
                    'uid' => 2,
                    "albumid" => 3
                ]);

3、删除

Model_Albart::getInstance()->Delete("id");

4、获取

Model_Article::getInstance()
                ->PageNum(0)
                ->PageSize(10)
                ->Select();

5、join

Model_Arttag::getInstance()->
            ->Where("a.articleid=?", [
            $_id
        ])
            ->Alias("a")
            ->Join("Tag", "a.tagid=b.id", "b")
            ->Field("b.tagname,b.tagshort,a.tagid")
            ->Select(false);

6、union

        Model_Activity::getInstance()->
            Union("select * from [Article]",true)
                ->Select();


{{collectdata}}

网友评论0

阿里云香港主机,免备案大优惠 打开浏览器开发html,体验云开发的乐趣bfweditor 打开浏览器即可开发php,bfwstudio
其他文章