The relationship between URL path access and module controller in thinkphp, Thinkphpurl
The relationship between URL path access and module controller in thinkphp is a very important part of thinkphp program development. Mastering this skill is very important for further learning thinkphp. The specific analysis is as follows:
To open the Controller page:
UserAction.class.php//path: admin\lib\action\ Here the admin for the new project corresponding to the directory
We all know that the method in action defaults to the public property, the method of the private property is inaccessible, but the method that defines the private property has its meaning.
The meaning of the private method is defined: it is mainly embodied in the ability to write a method related to the user module here, but you do not want the original method is too bloated, so we can define a private to implement, if the validation specification changes, only need to change one of the methods in the line. No need to find a lot of code to find.
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 of writing data to the database '; } Private Function Verify () { echo ' This is the method of validation ';}}
.. /admin.php/user/add Execution Results:
This is the way to verify that this is the way to write data to the database
I hope this article is helpful to everyone thinkphp program design.
thinkphp URL path Access Pattern related issues
It can be obtained with $_get.
As an example,
Index.php/action/function/id/2
$_get[cation] is function
$_get[id] is 2
Do you understand me? It's just a change of form, a value that can be taken.
URL Access for thinkphp
The main entry file is missing. The way you access this is in the state of rewriting.
To check the settings file:
"Url_model" =>2, check Apache settings and root rewrite files
or change to 1, using Pachinfo access.
http://www.bkjia.com/PHPjc/868227.html www.bkjia.com true http://www.bkjia.com/PHPjc/868227.html techarticle The relationship between URL path access and module controller in thinkphp, and the relationship between URL path access and module controller in Thinkphpurl thinkphp is a very important link in thinkphp program development ...