ThinkPHP Start_PHP Tutorial

WBOY
Release: 2016-07-14 10:10:28
Original
803 people have browsed it

Getting Started with ThinkPHP
1. What is ThinkPHP?
ThinkPHP is a free, open source, fast and simple object-oriented lightweight PHP development framework. It was born for agile WEB application development and simplified enterprise application development (1) Download the file package from thinkphp.cn official website
(2) Directory file introduction after decompression:

2. How to use ThinkPHP?

Create controllers and actions

Create GoodsAction.class.php file
In this file, the GoodsAction class inherits from the Action class
When accessing, add the parameter m=Goods&a=show
to the url The m parameter on the url represents:
m----module module means
ThinkPHP considers a controller to be a module when processing
a----Indicates the method pathInfo mode of the controller (module)
This form of carrying url parameters is not very beautiful,
ThinkPHP provides a new way to access
It’s called pathInfo mode,
For example, the above request can be written as:
And the default url mode of ThinkPHP is pathInfo mode
Model processing data
(1) First find out which database is used by the current project, and complete the configuration file through the configuration file. Complete an array in conf.php in the Conf directory of the project (you can refer to the default configuration of the system)
(2) Use the M() function provided by the framework to obtain the model. The parameter is the current table name (note that the first letter is capitalized)
Then call the select() method of the model to obtain all records of the current table, which is equivalent to getAll()
View layer displays data
Directly call the display() method of the current controller to complete the display of the template
The default display() can take no parameters and will automatically find the currently required template file in the template directory
When naming: Tpl/module/action.html
Template engine loop
Use foreach in ThinkPHP’s built-in template engine to complete the loop
Also tag syntax

The data label is curly braces {$data}; the array is accessed through . or [] can be used to access

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477473.htmlTechArticleGetting Started with ThinkPHP 1, What is ThinkPHP? ThinkPHP is a free and open source, fast and simple object-oriented lightweight PHP development framework for agile WEB application development and simplified enterprise applications...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!