Thinkphp coherent operation instance analysis, thinkphp instance Analysis _ PHP Tutorial

Source: Internet
Author: User
Thinkphp coherent operation instance analysis, thinkphp instance analysis. Thinkphp coherent operation instance analysis, thinkphp instance Analysis This article analyzes thinkphp consistent operation usage. Share it with you for your reference. The specific analysis is as follows: 1. Analysis of commonly used thinkphp coherent operation instances and thinkphp instances

This article analyzes thinkphp's consistent operation usage. Share it with you for your reference. The specific analysis is as follows:

1. commonly used coherent operations can be used in succession, but there is no distinction between the front and back order. the following methods must be available: select, updata, delete, find

1. where: helps us set query conditions

2. order: sort the results

The code is as follows:

$ Arr = $ m-> order ('Id desc')-> select (); // string method. the default value is asc in ascending order. change desc to descending order.
$ Arr = $ m-> order (array ('id' => 'desc', 'sex' => 'asc ')-> select (); // array method


3. limit: limit the result

The code is as follows:

Limit (2nd) // extract 5 from
Limit ('2, 5') // string format parameter
Limit (10) // equivalent to limit (). The default value is from 0.


4. field: Set the query field

The code is as follows:

Field ('username as name, ID') // pass the character and modify the field name
Field (array ('username' => 'name', 'id') // transmits an array to query and modify the field name.
Field ('id', true) // Obtain all fields except id


5. table: table

6. group: group

7. having: related to groups

II. Supplement

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

Page is used to query the strings and numbers of pages (which are converted to limit internally ).

Join * supports strings and arrays for join queries.

Union * is used to support strings, arrays, and objects for the union query.

The distinct used for query supports boolean values.

Boolean value of the lock mechanism used by the database

The cache is used to query the cache. multiple parameters are supported (detailed descriptions will be made later in the cache section)

Relation is used for association query (support for extension of association model is required) string

Validate is used to automatically verify the array of data

Auto is used to automatically complete the array of data

Filter is used to filter strings.

Scope * is used to name the range string, array

I hope this article will help you with ThinkPHP framework programming.

In this article, we analyze thinkphp's consistent operation usage. Share it with you for your reference. The specific analysis is as follows: 1. common coherent operations...

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.