tp5增删改查基本操作
//插入数据 $res = Db::execute('insert into phptab(info) values("小张")'); dump($res); //修改数据 $res = Db::execute('update phptab set info="你好tp" where id=1'); //删除数据 $res = Db::execute('delete from phptab where id=1'); //查询数据 $res = Db::query('select * from phptab'); dump($res); // // 防注入操作 $res = Db::execute('insert into phptab(info) values(:info)', ['info' => '你好tp']); $res = Db::execute('insert into phptab(info) values(?)', ["不太好"]); // PDO插入 $res = Db::table('phptab')->insert(['info' => '哈哈哈']); // 更新 $res = Db::table('phptab')->where('id', 2)->update(['info' => '迪迦']); $res = Db::table('phptab')->select(); $res = Db::table('phptab')->where('id', 5)->delete(); $db = Db::table('phptab'); $res = $db->insert(['info' => '哈哈哈']); $res = Db::name('phptab')->insert(['info' => '哈哈哈']); //统计数量count $res = $db->count('info'); dump($res); return 1;