数据库

1.数据库配置

1-1.配置文件配置【http://ww:7070/tp5-3/public/】

1-2.Db::connect配置【数组和字符串方式】【http://ww:7070/tp5-3/public/index/index/db1和http://ww:7070/tp5-3/public/index/index/db2】

1-3.model配置【数组和字符串方式】【http://ww:7070/tp5-3/public/admin】

2数据库普通链接

2-1.普通查询两种【http://ww:7070/tp5-3/public/index/test/test1和http://ww:7070/tp5-3/public/index/test/test2】【返回查询结果】

2-2.普通插入三种【http://ww:7070/tp5-3/public/index/test/test3和4和5】【返回影响的条数】

注意:Db::getLastSql()可以获取sql语句

2-3.普通删除三种【http://ww:7070/tp5-3/public/index/test/test6】【返回影响条数】

2-4.普通更新三种【http://ww:7070/tp5-3/public/index/test/test7】【返回影响条数】

3.常用方法

3-1.where限制条件【http://localhost:7070/tp/public/admin/sql/awhere1或awhere2和awhere3】

3-2.order升降序【http://localhost:7070/tp/public/admin/sql/aorder】

3-3.limit限制上限和分页【http://localhost:7070/tp/public/admin/sql/alimit1和http://localhost:7070/tp/public/admin/sql/alimit2】

3-4.group分组以及获取最大最小总量平均值 字段重命名【http://localhost:7070/tp/public/admin/sql/agroup】

3-5.having对于分组查询的结果进行筛选【http://localhost:7070/tp/public/admin/sql/ahaving】

3-6.join联动查询【http://localhost:7070/tp/public/admin/sql/ajoin】

3-7.union查询多个表,返回一个包含所有结果的数组【http://localhost:7070/tp/public/admin/sql/aunion】

3-8.distinct只会返回不重复的值【http://localhost:7070/tp/public/admin/sql/adistinct】

3-9.聚合查询【avg,count,max,min,sum】

4.事务机制

4-1.主动控制【http://localhost:7070/tp/public/admin/sql/event1】

4-2.手动控制【http://localhost:7070/tp/public/admin/sql/event2】

tp5总结(四)的更多相关文章

  1. PHP7 学习笔记(十四)Reids 键空间通知配合TP5 实现分布式延时任务

    测试环境:windows 10 + phpStudy 配置redis配置文件 redis.windows.conf notify-keyspace-events "Ex" 重启re ...

  2. TP5.1:request请求对象(使用四种方式获取)

    准备: 在index/controller下创建一个名为requests.php的文件(注意:不要起名为request,因为它是关键字,不被允许起名) 动态方法和静态方法的区别: 静态方法:publi ...

  3. TP5学习基础二:目录结构、URL路由、数据操作

    一.安装1.使用git或者composer(composer update)进行实时更新,区别在于git不会清空核心框架目录而composer会清空.2.使用官网打包好的TP压缩包(解压即可用)-&g ...

  4. 接口开发,tp5结合swagger-ui安装方法

    今天看到老java用的swagger提供接口,美观好用,方便维护,不是写好接口之后再写接口文档,麻烦的要死.网上找了找结合php的方法,在此记录一下,以后再开发接口就可以方便很多了. Swagger的 ...

  5. TP5 路由使用

    这里可以直接从第四条开始看 原文http://www.upwqy.com/details/12.html 1 文档链接 tp5路由官方文档  https://www.kancloud.cn/manua ...

  6. 【转】史上最详细的Composer安装tp5教程

    http://www.thinkphp.cn/topic/52362.html Composer安装tp5教程1.下载composer先介绍几个网站Composer官网https://getcompo ...

  7. TP5 数据库迁移工具 migrate 教程

    第一步: 安装compose,不赘述,安装详情可百度或查看https://pkg.phpcomposer.com/#how-to-install-composer 第二步: 通过 composer   ...

  8. TP5调用微信JSSDK 教程 - 测试成功案例

    前提:必需了解TP5的全局配置,扩展目录,composer,依赖注入的概念: 第一步:首先配置加载官方JSSDK类 "autoload": { "files": ...

  9. PHP 服务器及TP5框架遇到的几个错误

    一.Call to undefined function imagecreatefrompng(): LAMP环境搭建的博客,在提交内容的时候TP5框架报了一个错误,Call to undefined ...

随机推荐

  1. SDOI2017 Round1 起点

    第二次打酱油了 高一两次考试以打两瓶酱油告终 来的时候明知自己没戏,却总存有一丝希望 NOIP连200都没考到,是不是有点儿不自量力 如果我真的去争取那一丝希望的话,该有多好 先简单分析下考试 Day ...

  2. Java并发编程原理与实战三十七:线程池的原理与使用

    一.简介 线程池在我们的高并发环境下,实际应用是非常多的!!适用频率非常高! 有过使用过Executors框架的朋友,可能不太知道底层的实现,这里就是讲Executors是由ThreadPoolExe ...

  3. Javascript 常用的工具函数,更新中...

    1.时间戳转为格式化时间 /** * 时间戳转为格式化时间 * @Author chenjun * @DateTime 2017-11-10 * @param {[date]} timestamp [ ...

  4. js生成接口请求参数签名加密

    js生成接口请求参数签名加密 定义规则:将所有参数字段按首字母排序, 拼接成key1 = value1 & key2 = value2的格式,再在末尾拼接上key = appSecret, 再 ...

  5. C# 中printDocument打印、预览、打印机设置和打印属性的方法

    private void Form1_Load(object sender, System.EventArgs e) { //获取或设置一个值,该值指示是否发送到文件或端口 printDocument ...

  6. 【leetcode 简单】 第八十九题 赎金信

    给定一个赎金信 (ransom) 字符串和一个杂志(magazine)字符串,判断第一个字符串ransom能不能由第二个字符串magazines里面的字符构成.如果可以构成,返回 true :否则返回 ...

  7. 倍增 Tarjan 求LCA

                                                                                                         ...

  8. Once you eliminate all the other factors,the only thing remaining must be the truth.

    Once you eliminate all the other factors,the only thing remaining must be the truth. 一旦你排除了杂因,剩下的一定是 ...

  9. Next Permutation & Previous Permutation

    Next Permutation Given a list of integers, which denote a permutation. Find the next permutation in ...

  10. Ubuntu下安装arm-linux-gnueabi-xxx编译器【转】

    转自:http://blog.csdn.net/real_myth/article/details/51481639 from: http://www.linuxdiyf.com/linux/1948 ...