TP Frame
Entry file: index.php
Application: folder where items are stored (can be changed)
Jiaowu: (new folder for storing items)
{
Common: Store function
Home: module
{
Common: Store function
Conf: Configuration folder->config.php Modify configuration file
Controller: Logic layer (Implement business logic) < important level >
Model: Models layer (Operation data, data access, data connection)
View: Views layer (show template)
(
Three-tier architecture MVC: Conventions are better than configuration
1. Different files have different storage paths depending on different content
2. Follow the naming rules: Controller name controller.class.php
3. In the View folder to do the corresponding template file, you need to build a controller folder, the controller's folder can only be placed under the controller of this method corresponding template file
)
}
Runtime: Cache
{
Cache: Caching Files
Data: Database Cache
}
}
Public: Store common items (usually not stored in this folder, but in the project folder)
Thinkphp: Core Folder
{
Common: core Function library
Conf: Config file (this should be in convention.php)
Lang: Language pack
Library: Core repository (Core Class)
{
Think: The classes used are basically here
}
Mode: Model
TPL: Templates
}
Namespace Home\controller (defining namespaces)
Use Think\controller (using namespaces)
thinkphp->library->think->controller.class.php (parent class for all controllers)
Class Indexcontroller extends controller (subclass Indexcontroller inherits from parent controller)
Action: The method of operation, placed in the controller
Previous access: Specific pages of the visit
Access: Access control's operations (methods), not a specific page
Method of Access
1. Locate the entry file index.php
2. Four modes of Access
{
1. Basic get mode:/HTTP URL/index.php?m=xx&c=xx&a=xx
2. Path mode:/HTTP//module/Controller/operation Method (example: Localhost:8080/thinkphp/index.php/home/login/index/login)
3.rewrite rewrite mode:/HTTP//module/Controller/operation method
4. Compatibility mode:/http//URL/index.php?s=/module/controller/method
}
The specific URL address pattern can be set through the configuration file
(Thinkphp->thinkphp->conf->convention.php->url_model)
U () shortcut function for making URL address
C (name) get configuration variable (convertion.php config.php) information
C (name, value) setting configuration variable information
L () Get language variable information
E () Output error message to page
A ("Project://module/controller") instantiates the Controller object
A ("Home/user") instantiates the User controller object
A ("Book://home/user") instantiates the User controller object of the Home module of the book Project
To pick up trace information
Add: ' Show_page_trace ' =>true in the configuration file (required in development debug mode)
PHP TP Framework Basics