thinkphp Coherent Operation Example analysis, thinkphp case analysis
This paper analyzes the usage of thinkphp coherent operation. Share to everyone for your reference. The specific analysis is as follows:
One, commonly used coherent operation, can be used in succession but not the order of the points, the following must have a method select,updata,delete,find
1.where: Help us set query criteria
2.order: Sort the results
Copy the code as follows: $arr = $m->order (' id desc ')->select ();//String method, default ASC ascending order, and desc to descending order
$arr = $m->order (array (' id ' = ' desc ', ' sex ' = ' asc '))->select (); Array method
3.limit: Limit Results
Copy the Code code as follows: Limit (2,5)//Remove 5 from the 2nd article
Limit (' 2,5 ')//note String form parameter
Limit (10)//equals limit (0,10) by default starting from 0
4.field: Set query fields
Copy the Code code as follows: Field (' username as Name,id ')//Pass character, modify field name
Field (Array (' username ' = ' name ', ' ID ')//array query, modify field name
Field (' id ', true)//Get all fields except ID
5.table: Table
6.group: Grouping
7.having: Related to Grouping
Second, supplementary
Alias is used to define the aliases string for the current data table
Page is used to query paging (internally converted to limit) strings and numbers
Join* for join support strings and arrays for queries
Union* used to support strings, arrays, and objects for the Union of Queries
Distinct distinct support for querying Boolean values
Lock mechanism Boolean value for the database
Cache supports multiple parameters for query caching (later described in detail in the cache section)
Relation for associative queries (requires associated model extension support) strings
Validate for data auto-validation arrays
Auto for data auto-complete array
Filter for data filtering strings
scope* for naming range strings, arrays
It is hoped that this article will be helpful to everyone's thinkphp framework design.
http://www.bkjia.com/PHPjc/916066.html www.bkjia.com true http://www.bkjia.com/PHPjc/916066.html techarticle thinkphp Coherent Operation example Analysis, thinkphp example analysis of thinkphp coherent operation usage. Share to everyone for your reference. The specific analysis is as follows: first, commonly used coherent ...