The examples in this article summarize the thinkPHP query method. Share it with everyone for your reference, the details are as follows:
1. Ordinary query method
1. Use string query;
Copy the code The code is as follows:
$m->where(' id=1 and name="roge" ')->find();
A disadvantage of this method is that when the query field in the data table is a string, quotation marks need to be added to the field value.
2. Using arrays (recommended)
$data['name']="adfa"; $data['id']=3; $data['_logic']="or"; //字段之间的逻辑关系,默认为and的关系 $m->where($data)->find();
2. Expression query
EQ is equal to;
NEQ is not equal to;
GT is greater than;
EGT is greater than or equal to;
LT is less than;
ELT is less than or equal to;
LIKE Fuzzy query;
$data['id']=array('gt',6); $data['name']=array('like','%as%'); //notlike //$data['name']=array('like',array('%as%','%ts'),'and'); 默认为or关系,如果用and需要明确指定 $m->where($data)->select(); //其他查询 between, not between (之间有空格),in,not between,
3. Interval query
$data['id']=array(array('gt',5),array('lt',10)); //默认生成的是and的关系 //$data['id']=array(array('lt',5),array('gt',10),'or') $data['name']=array(array('like','%d%'),array('like','%e%'),'gege','or'); $m->where($data)->select();
4. Statistical query
count, max, min, avg, sum
Copy code The code is as follows:
$m- >max('id')
5. SQL direct query
$m=M(); $result=$m->query("select * from think_user where id>1") //query主要用于对数据进行读取 $result=$m->execute("insert into think_user(`name`) values ('dfd') "); //execute用于对数据进行写入
For more information related to thinkPHP, please check out the special topics on this site: "ThinkPHP Getting Started Tutorial" and "Summary of Common Methods of ThinkPHP"
I hope this article will explain It will be helpful for everyone to design PHP programs based on the thinkPHP framework.
The above is a summary of thinkPHP query methods, including relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

本篇文章给大家带来了关于thinkphp的相关知识,其中主要介绍了关于使用think-queue来实现普通队列和延迟队列的相关内容,think-queue是thinkphp官方提供的一个消息队列服务,下面一起来看一下,希望对大家有帮助。

thinkphp基于的mvc分别是指:1、m是model的缩写,表示模型,用于数据处理;2、v是view的缩写,表示视图,由View类和模板文件组成;3、c是controller的缩写,表示控制器,用于逻辑处理。mvc设计模式是一种编程思想,是一种将应用程序的逻辑层和表现层进行分离的方法。

thinkphp扩展有:1、think-migration,是一种数据库迁移工具;2、think-orm,是一种ORM类库扩展;3、think-oracle,是一种Oracle驱动扩展;4、think-mongo,一种MongoDb扩展;5、think-soar,一种SQL语句优化扩展;6、porter,一种数据库管理工具;7、tp-jwt-auth,一个jwt身份验证扩展包。

标题:C#中使用Array.Sort函数对数组进行排序的示例正文:在C#中,数组是一种常用的数据结构,经常需要对数组进行排序操作。C#提供了Array类,其中有Sort方法可以方便地对数组进行排序。本文将演示如何使用C#中的Array.Sort函数对数组进行排序,并提供具体的代码示例。首先,我们需要了解一下Array.Sort函数的基本用法。Array.So

在thinkphp3.2中,可以利用define关闭调试模式,该标签用于变量和常量的定义,将入口文件中定义调试模式设为FALSE即可,语法为“define('APP_DEBUG', false);”;开启调试模式将参数值设置为true即可。

本篇文章给大家带来了关于thinkphp的相关知识,其中主要总结了一些笔记知识点,包括了模型、系统服务、laket-admin项目等内容,下面一起来看一下,希望对大家有帮助。

ThinkPHP vs Laravel 当下国内最流行的两款PHP框架,孰好孰坏,争议最多!做为初学者,也很纠结,到底学哪个好呢?本文PHP中文网来认真盘点一下,不吹不黑,更不便偏颇哪一方。

在进行PHP编程时,我们常常需要对数组进行合并。PHP提供了array_merge()函数来完成数组合并的工作,不过当数组中存在相同的键时,该函数会覆盖原有的值。为了解决这个问题,PHP在语言中还提供了一个array_merge_recursive()函数,该函数可以合并数组并保留相同键的值,使得程序的设计变得更加灵活。array_merge


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
