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