thinkphp Start _php Tutorial

Source: Internet
Author: User
Thinkphp Getting Started
What is 1,thinkphp?
Thinkphp is a free, open-source, fast and simple object-oriented lightweight PHP development framework for Agile Web application development and simplified Enterprise application Development (1) Download packages from thinkphp.cn official website
(2) After decompression directory file description:

2, how to use thinkphp?

Create a controller, action

Create a GoodsAction.class.php file
In this file, the Goodsaction class inherits from the action class
When accessing, by adding parameters to the URL m=goods&a=show
Where the M parameter on the URL indicates:
M----The meaning of module modules
Thinkphp A controller is considered a module when processing
A----method PathInfo mode that represents the controller (module)
The form of this carry URL parameter is not very beautiful,
Thinkphp provides a new way to access
Called PathInfo mode,
For example, the above request can be written as:
and thinkphp The default URL pattern is pathinfo mode
Model processing Data
(1) First find the current project using which database, through the configuration file to complete the configuration file in the Conf directory of the project conf.php complete an array (can refer to the system's default configuration)
(2) Use the M () function provided by the framework to obtain the model with the current table name (note the first letter capitalized)
Then call the model's Select () method to get all the records for the current table, equivalent to GetAll ()
View Layer Display data
Directly call the display () method of the current controller to complete the presentation of the template
The default display () is available without parameters and will automatically find the template file currently needed in the template directory
Name: tpl/module/action. html
Template engines Follow
Use foreach in the thinkphp built-in template engine to complete the loop
is also the label syntax

Data labels are curly braces {$data}; Array is passed. Access, or you can use [] to access

http://www.bkjia.com/PHPjc/477473.html www.bkjia.com true http://www.bkjia.com/PHPjc/477473.html techarticle What is the thinkphp entry 1,thinkphp? Thinkphp is a free, open-source, fast and simple object-oriented, lightweight PHP development Framework for Agile Web application development and simplified enterprise applications ...

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