Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A case study of the usage of thinkphp coherent Operation

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the "case analysis of thinkphp coherent operation usage". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "thinkphp coherent operation usage case analysis".

In this paper, the usage of thinkphp coherent operation is analyzed by an example. Share it with you for your reference. The specific analysis is as follows:

First, commonly used coherent operations, can be used one after another, but there is no difference between before and after the sequence, there must be a method select,updata,delete,find

1.where: help us set query conditions

2.order: sort the results

The copy code is as follows:

$arr=$m- > order ('id desc')-> select (); / / string method. Default is asc ascending order, and desc is changed to descending order.

$arr=$m- > order (array ('id'= >' desc','sex'= > 'asc'))-> select (); / / Array method

3.limit: limit result

The copy code is as follows:

Limit (2jue 5) / / take out 5 articles from Article 2

Limit ('2Band 5') / / string form parameter

Limit (10) / / is equivalent to limit (0Jing 10). The default is 0.

4.field: setting query field

The copy code is as follows:

Field ('username as name,id') / / pass characters to modify the field name

Field (array ('username'= >' name','id') / / pass array query to modify field name

Field ('id',true) / / get all fields except id

5.table: tabl

6.group: grouping

7.having: related to grouping

II. Supplement

Alias is used to define an alias string for the current data table

Page is used to query paging (internally converted to limit) strings and numbers

The join used by join* to support strings and arrays for queries

Union* is used to support strings, arrays, and objects for union queries

The distinct used by distinct for queries supports Boolean values

The Boolean value of the locking mechanism used by lock for the database

Cache is used to query the cache to support multiple parameters (described in detail later in the cache section)

Relation is used for associative queries (correlation model extension support is required) strings

Validate is used for automatic data validation array

Auto is used for data auto-completion array.

Filter is used for data filtering strings

Scope* is used to name range strings, arrays

Thank you for your reading, the above is the content of "thinkphp coherent operation usage example analysis". After the study of this article, I believe you have a deeper understanding of the problem of thinkphp coherent operation usage example analysis, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report