1.Select 查询语句 占位方式一
//sql 查询语句 占位方式一
$sql = "select * from tp_articles where id =?";
$result = Db::query($sql,[104]);
dump($result);
Select 查询语句 占位方式二
//sql 查询语句 占位方式二
$sql = "select * from tp_articles where id =:id";
$result = Db::query($sql,["id" => 103]);
dump($result);
2.insert 插入语句
//插入语句
$sql = "insert into tp_articles(title,desn,body) values(:title,:desn,:body)";
$result = Db::execute($sql,['title' => '我是标题111', 'desn' => '我是描述','body'=>'aaaaaa']);
dump($result);
3.修改语句
//修改语句
$sql = "update tp_articles set title=:title where id=:id";
$ret = Db::execute($sql,["title" => "我是队长啊威啊","id" => 220]);
dump($ret);
4.删除语句
//删除语句
$sql = "delete from tp_articles where id=:id";
$ret = Db::execute($sql,["id" => 220]);
dump($ret);