This article mainly introduces ThinkPHP3.2.2 plug-in controller function. For more information, see
This article mainly introduces ThinkPHP3.2.2 plug-in controller function. For more information, see
ThinkPHP versions 3.2.2 support calling plug-in controllers. You can access the Controller defined by a plug-in the module through a more convenient URL address.
When the plug-in Controller Variable is input in the URL, the Operation Method in the plug-in controller is automatically located.
The variables of the plug-in controller are set by the VAR_ADDON parameter. The default value is addon. For example, we input the following variables in the URL:
Because the addon parameter is passed in, the User controller here is not the original
Home/Controller/InfoController. class. php
Instead, call the InfoController controller of the SystemInfo plug-in (located under the Home/Addon directory). The file is located in
Home/Addon/SystemInfo/Controller/InfoController. class. php
The plug-in controller itself is defined like a common access controller, for example:
Namespace Home \ Addon \ SystemInfo \ Controller; class InfoController extends \ Think \ Controller {public function index () {echo 'addon systeminfo ';}}
In this way, we are accessing
Will output
Addon SystemInfo
If our plug-in directory is not Addon but Plugin, we need to define it in the configuration file:
'Var _ addon' => 'plugin'
Then the access URL becomes
Note: currently, the plug-in controller only supports access from the plug-in controller of the module, and does not support global public plug-ins.