The first () method is used to obtain the first record that meets the condition. it is a method in the advanced model class. you can refer to getN () to locate the query.
ThinkPHP supports data locating and query:
GetN (): Gets a record at a
Use Yii form control CActiveForm
Add:?
1234567
BeginWidget ('cactiveform', array ('id' => 'contact-form', 'enableclientvalidation '=> true, 'clientopexception' => array ('validateonsubmit '=> true,),);?>
Show all errors:?
In Yii, js and css files are introduced directly under the template and directly under the Template :?
123456
Yii: app ()-> clientScript-> registerScriptFile (Yii: app ()-> baseUrl. "/js/common. js "); Yii: app ()-> clientScript->
ThinkPHP supports interval query for a field
ThinkPHP supports interval query for a field.
Example 1:
Public function read (){
$ Dao = M ('user ');
$ Condition ['uid'] = array ('GT ', 1), array ('Lt', 5 ));
$ List = $ Dao->
ThinkPHPgetBy is a magic method to dynamically query a data record based on a field name. GetBy dynamic query
ThinkPHP
GetBy dynamic query is a magic method that dynamically obtains a data record based on a field name.
Query the corresponding user
Get http: // 127.0.0.1/test/index? Var = val content:
Get http: // 127.0.0.1/test/index? Var = val content:?
12345
Yii: app ()-> request-> getUrl/test/index? Var = valYii: app ()-> request-> getHostInfo http: // 127.0.0.1Yii: app ()
ThinkPHP provides the success and error methods for page jumps with prompt information, such as displaying prompt information and redirecting after adding data. The success method is used for the prompt after the operation is successful, and the
$ Cookie-& gt; expire = time () + 60*60*24*30; // Use of Yii Framework cookies with a time limit of 30 days
Set Cookie:
?123456 // Create a cookie first$ Cookie = newCHttpCookie ('qblog', 'Test cooker ');// Define the cookie validity period$
ThinkPHP automatically verifies and fills ThinkPHP M methods when using the M method (without creating model classes ).
In general, we will write the automatic verification and automatic filling rules into the model class, and then use D
The method
The format of ThinkPHP automatic verification is as follows (for more information, see ThinkPHP automatic verification and verification rules): review of the ThinkPHP automatic verification syntax
The format of ThinkPHP automatic verification is as
Generally, the verification rules for each data table are relatively fixed, but in some special cases, the verification rules may be changed. The Model class of ThinkPHP provides the setProperty method. you can use the setProperty method in the
Automatic verification and automatic filling are frequently used when ThinkPHP is used, but sometimes automatic verification and automatic filling are invalid, this article analyzes the possible causes of ThinkPHP automatic verification and
As a PHP development framework, ThinkPHP has its own set of naming rules. ThinkPHP-based development should follow the ThinkPHP naming rules as much as possible
As a PHP development framework, ThinkPHP has its own set of naming rules. In ThinkPHP-
A third-party class library is a class library other than the ThinkPHP framework and application project class library. it is generally provided by a third-party system or product, such as a third-party class library for systems such as Smarty and
Assume that the insert operation is performed on the Aritcle module of the default HOME group. in some examples, redirect redirection is performed on the project group.
Redirect
The general syntax of redirection is:
Redirect (url, params = array ()
ThinkPHP regular routing can implement more complex routing Definitions. the regular routing syntax is as follows: ThinkPHP regular routing
ThinkPHP
Regular routing can implement more complex routing Definitions. the regular routing syntax is as
The U method is a built-in shortcut of ThinkPHP. you can dynamically generate a smart URL address based on the system URL mode. ThinkPHP U method
The U method is a built-in shortcut of ThinkPHP. you can dynamically generate intelligent URLs based
ThinkPHP has built-in support for verification codes and can be used directly. To use the verification code, you need to import the ORG. Util. Image class library in the extended class library and the ThinkPHP verification code library ORG. Util.
This section applies to ThinkPHPV2.0. if you need to know the routes of other versions, this section applies to ThinkPHP V2.0. if you need to know the routes of other versions, see:
ThinkPHP 3.0 route
ThinkPHP
2.1 Route
URL routing
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