tp5如何在模板使⽤原⽣php语句,tp5中使⽤原⽣sql语句的⽅法注意事项:1.先在database.php中配置好数据库2.只要是数据库操作必须引⽤ use/think/Db;严格区分⼤⼩写。下⾯是⽅法://所有查询必须 use/think/Db; /* 1 配置数据库
* 2 使⽤DB 命名空间
*
频率补偿电路
*/
/****************tp5中使⽤原⽣语句*******************/
//query ⽤于查询 其他的⽤execute
回转半径
// 插⼊记录
// $result = Db::execute('insert into sb_ad (ad_name, ad_content ,status) values (1, "456",1)');
// 更新记录
牙科手机
// $result = Db::execute('update sb_ad set ad_name = "framework" where ad_id = 1 ');
// 查询数据
// $result = Db::query('select * from sb_ad where ad_id = 1');
// 删除数据
// $result = Db::execute('delete from sb_ad where ad_id = 2 ');
//其它操作
// 显⽰数据库列表
// $result = Db::query('show tables from tpshop1');何叔衡
鼎湖山听泉
赏析听诊器古今谈// 清空数据表
// $result = Db::execute('TRUNCATE table sb_ad');