Thinkphp internal functions D (), F (), S (), C (), L (), A (), I ()

Source: Internet
Author: User
Thinkphp internal functions

SubmittedMjxheheOn 2010, January 20, PM. php


D, F, S, C, L, A, and I are all in functions. php.
Next I will explain their functions separately.

D () load model class
M () load model class

A () load action class
L () Obtain language Definitions
C () Get configuration value usage is C ("the subscript entered in the array in the configuration file ")
S () Global cache configuration usage S ("This is a unique identifier ")
F () Fast File Data Reading and saving for simple types of data strings, Arrays
I () quickly create an object instance

If any of the above internal functions is missing

Thinkphp is worth learning the source code, especially their Chinese comments, which makes it easy for us to understand the content in the source code.

Using thinkphpProgramInternal functions that can be used frequently. Replacing this one with S () will reduce the burden on the database!

In thinkphp, the configuration file is saved as a static variable and can be conveniently and quickly called in the template.

If {$ thinkphp. config. parameter name}

If the primary key increases automatically, when you use add (), it will automatically return an id value for inserting a new record.

We need to add 1 to the specified field when making user gold coins, points, or votes. At this time, we can write

$ S = D ('admin'); $ S-> score = '(score + 1)'; $ S-> Save (); this leaves us with many steps.

If you want to modify a specified field, use the simple method d ('admin')-> setfield ('name', 'he', 'Id = 2 ');

We need to flexibly apply thinkphp query statements.

Size: 389X500
Browsing: 7 times
Click Open new window to view the full graph "width =" 389 "Height =" 500 "style =" padding: 0px; margin: 0px; ">

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.