THINKPHP5原生查询,两种方式
一、query方法
Db::query("select * from think_user where status=1");
二、execute方法
代码如下(示例):
Db::execute("update think_user set name='thinkphp' where status=1");
三.参数绑定
代码如下(示例):
Db::query("select * from think_user where id=? AND status=?",[8,1]);
// 命名绑定
Db::execute("update think_user set name=:name where status=:status",['name'=>'thinkphp','status'=>1]);