ThinkPHP 之 自定义模型、连贯操作要点
我来总结一下学了什么~
获取数据主键的方法:$goods_model -> getPk();
实例化数据表两种方法 new Model() ; M()快捷方法 快捷方法只占用一次内存而第一种方法会每次增加一次内存存储量
query()获得查询结果 execute()获得影响行数
D()方法用来获取自定义模型,D()函数的执行顺序为首先查找自定义模型当文件名和类名符合规则后执行自定义模型,若有不符合则查找表名进行实例化,若没有符合表名则返回false
连贯操作
field()为显示范围,where()为取值条件:用数组或对象作为条件,limit()为取值个数,order(para desc)为排序,group()为按照字段分组自动排序,having()另一种取值条件,table(tbname)为跨越表取值,table(db.tbname)为跨越数据库进行取值,定义数组$cont['para']=array('like','%a%');进行生成数组条件控制sql,sum()求和,avg()平均数,count()求个数

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

WebStorm Mac version
Useful JavaScript development tools
