Thinkphp from the 3.2.2 Release to support the call of the plug-in controller, can be accessed through a more convenient URL address to the module of a plug-in-defined controller.
When a plugin controller variable is passed in the URL, it is automatically positioned to the action method in the plug-in controller.
The variable of the plugin controller is set by the parameter Var_addon, which defaults to ADDON, for example, we pass in the URL:
Http://serverName/Home/info/index/addon/SystemInfo
Because the addon parameter is passed in, the user controller here is not the original
home/controller/infocontroller.class.php
Instead, it calls the Infocontroller controller of the SystemInfo plug-in (under the Home/addon directory), which is located
home/addon/systeminfo/controller/infocontroller.class.php
The plug-in controller itself is defined as the normal 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 visiting
Http://serverName/Home/info/index/addon/SystemInfo
It will output when the
Addon SystemInfo
If our plug-in directory is not addon, but plugin, then we need to define it in the configuration file:
' Var_addon ' = ' plugin '
Then accessing the URL address becomes
Http://serverName/Home/info/index/plugin/SystemInfo
It is important to note that the plug-in controller currently supports only the module's plug-in controller access and does not yet support the global public plug-in.