Find the Lib/Action directory under the project folder. There is a created example IndexAction.class.php below. The admin project we created is ./admin/Lib/Action/IndexAction.class.php. This module is the module loaded by default. In ThinkPHP, automatically loaded actions, methods, operations, etc. are named after index.
Next, we create our own module, such as UserAction, class.php (note the naming rules), we edit this file:
Copy the code The code is as follows:
//Inherit first Action class, note: the file name must be consistent with the class name
class UserAction extends Action
{
//The default action (operation, method) loaded in each module is the index method
function index ()
{
echo ' You have come to the user module';
}
//The naming rules for methods (operations, actions) are: the first word is lowercase, followed by the first letter in uppercase
function listName()
{
echo 'Your name is'. $_GET['name'];
}
}
?>
The above introduces the first module application written by thinkpade400578mdc in ThinkPHP, including the content of thinkpade400578mdc. I hope it will be helpful to friends who are interested in PHP tutorials.