The relationship between the URL path access in ThinkPHP and the module controller, thinkphpurl. The relationship between the URL path access in ThinkPHP and the module controller, the relationship between URL path access in thinkphpurlThinkPHP and the module controller is a very important link in ThinkPHP program development. The relationship between URL path access in ThinkPHP and the module controller is thinkphpurl.
The relationship between URL path access in ThinkPHP and the module controller is an important part in ThinkPHP program development. Mastering ThinkPHP skills is crucial to further learning ThinkPHP. The specific analysis is as follows:
Open the controller page:
UserAction. class. php // path: admin \ Lib \ Action \ here admin is the directory corresponding to the new project
We all know that the method in Action is the Public attribute by default, and the method of private attribute cannot be accessed, but the method of defining private attribute also has its significance.
The significance of defining private methods is as follows: you can write a method related to the user module here, but you do not want the original method to be too bloated. therefore, we can define a private implementation. if the verification specification changes, we only need to modify one of the methods. You don't have to find a bunch of code.
The sample code is as follows:
Class UserAction extends Action {function index () {echo 'this is the homepage';} function add () {$ this-> verify (); echo 'This is the method for writing data to the database';} private function verify () {echo 'This is the verification method ';}}
../Admin. php/User/add execution result:
This is the verification method. this is the method for writing data to the database.
I hope this article will help you with ThinkPHP programming.
ThinkPHP url path access mode problems
It can be obtained using $ _ GET.
For example
Index. php/action/function/id/2
$ _ GET [cation] is the function
$ _ GET [id] is 2
Do you understand? The format is changed, and the value is the same.
Thinkphp URL access
The master Portal file is missing. Your access method is rewritten.
Check the setting file:
"URL_MODEL" => 2. check apache settings and root directory rewriting files.
Or change to 1 and use pachinfo for access.
The relationship between URL path access in ThinkPHP and the module controller is a very important loop in ThinkPHP program development...