thinkphp Coherent Operation Example Analysis, thinkphp example Analysis _php tutorial

Source: Internet
Author: User

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.