Find the project folder below the Lib/action this directory, there is a good example to create IndexAction.class.php, join us to create the admin this project, then./admin/lib/action/ IndexAction.class.php, this module is the default loaded module. In thinkphp, the auto-loaded actions, methods, actions, and so on are all named by index.
Below, we create a module of our own, such as useraction,class.php (note naming rules), we edit this file:
Copy CodeThe code is as follows:
First inherit the action class, note: The file name should be consistent with the class name
Class Useraction extends Action
{
The actions (actions, methods) that are loaded by default in each module are the index method
Function index ()
{
Echo ' You came to the user module ';
}
Method (action, action) naming rule is: first word lowercase followed by the first letter uppercase
function ListName ()
{
Echo ' Your name is '. $_get[' name '];
}
}
?>
Next in the browser test:
Input: Http://thinkphp.com/admin.php?m=user, Output: You came to the user module
Input: Http://thinkphp.com/admin.php?m=user&a=index, Output: You came to the user module
Input: http://thinkphp.com/admin.php?m=user&a=listname, Output: Your name is
Input: http://thinkphp.com/admin.php?m=user&a=listname&name=123, Output: Your name is 123.
http://www.bkjia.com/PHPjc/325155.html www.bkjia.com true http://www.bkjia.com/PHPjc/325155.html techarticle Find the project folder below the Lib/action this directory, below a good example of the creation of IndexAction.class.php, join us to create the admin this project, then./admin/lib/action/ ...