Thinkphp from version 3.2.2 to support calls to the plug-in controller, which can be accessed through a more convenient URL address to a plug-in-defined controller in the module.
The action method in the plug-in controller is automatically positioned when the plug-in controller variable is passed in to the URL.
The variables for the plug-in controller are set by the parameter Var_addon, and the default is 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 (located under the Home/addon directory), which is located in the
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
If our plugin directory is not addon, but plugin, then you need to define in the configuration file:
' Var_addon ' => ' plugin '
And then access the URL address becomes
Http://serverName/Home/info/index/plugin/SystemInfo
Note that the plug-in controller currently supports only the plug-in controller access for the module and does not yet support global public plug-ins.