thinkphp Simple Knowledge Point (ii)

Source: Internet
Author: User

1. Describe the principles of MVC and the benefits of single-entry mode?

  

Benefits of Single entry mode: safe and flexible. Centralized security processing, access to statistics and other unified control. 2. Why should the PHP version be judged in the import file, and what is the version of PHP required for TP?

  because ThinkPHP3.2 introduces the concept of namespaces,PHP5.3 above (including PHP5.3) Support

PHP version cannot be less than 5.3.0

3. What is the controller definition rule (including controller name, controller class name, and controller class file name) and an example?

controller name: Capitalize first letter. Example:Index Controller class name: Controller name +controller. Example:indexcontroller Controller class file name: Controller class name +.class.php. Example:IndexController.class.php

4. what are the two ways to generate a new module?

  1.define (' Bind_module ', ' Admin ');

2. copy the Home module

5. What are the five instantiation methods of the model class, each of which is cited as an example?

1. Instantiate an empty model class: $model =new models ();

2. Instantiate the underlying model class: $model =new model ([' model name '],[' data table prefix '],[' database connection information ']);3.M method Instantiation of the underlying model class: $model =m ([' Model name '],[' data table prefix '],[' database connection information ']);4. Instantiate a custom base model class: $model =new Model class operation name ([' Model name '],[' data table prefix '],[' database connection information ');5.D method instantiates a custom base model class: $model =d ([' Model name '],[' data table prefix '],[' database connection information ']);

what is the equivalent full native method for setting default values for the 6.I method?

  Example:$id =isset ($_get[' id ")? $_get[' id '];

7. The difference between implicit query and display query, which is more efficient, please give examples of two kinds of writing rules of Query method;

  difference: Display query can improve query speed, high efficiency; Show queries more efficiently

Explicit query:field For example:$this->field (' name ', ' pwd ')->select (); Implicit query: For example:$this->select ();

8. What is the coherent operation for specifying field updates and insertions, and how do you specify field insertions and modifications?

  Update:SetField Example:$User, where (' id=5 ')->setfield (' name ', ' thinkphp ');

Insert:Add () $User->data ($data)->add ();

9. How is the template theme called, and How does the view-level catalog need to be adjusted after using the template theme?

Template Theme call:$this->theme (' Blue ')->display (); View-level catalog:--view--blue/  / template theme              --index/  / controller name                --color.html// Template Theme page                 

thinkphp Simple Knowledge Point (ii)

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.