tp5如何在模板使用原生php语句,tp5中使用原生sql语句的方法

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');

本文发布于:2024-09-20 20:24:48,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/153116.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:数据库   赏析   数据   频率   语句   空间
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议