ThinkPHP3.2.2 plug-in controller function, thinkphp3.2.2 plug-in_PHP tutorial

WBOY
Release: 2016-07-13 10:05:31
Original
890 people have browsed it

ThinkPHP3.2.2 plug-in controller function, thinkphp3.2.2 plug-in

3.2.2 version starts to support the calling of plug-in controller, and the module can be accessed through a more convenient URL address A controller defined by a plug-in.

When the plug-in controller variable is passed in the URL, the operation method in the plug-in controller will be automatically located.

The variables of the plug-in controller are set by the parameter VAR_ADDON. The default is addon. For example, we pass it in the URL:

Copy code The code is as follows:
http://serverName/Home/info/index/addon/SystemInfo

Since the addon parameter is passed in, the User controller here is not the original one

Copy code The code is as follows:
Home/Controller/InfoController.class.php

Instead, the InfoController controller of the SystemInfo plug-in (located under the Home/Addon directory) is called. The file is located at

Copy code The code is as follows:
Home/Addon/SystemInfo/Controller/InfoController.class.php

The definition of the plug-in controller itself is the same as that of an ordinary access controller, for example:

Copy code The code is as follows:
namespace HomeAddonSystemInfoController;
class InfoController extends ThinkController{
Public function index(){
echo 'Addon SystemInfo';
}
}

In this way, we are visiting

Copy code The code is as follows:
http://serverName/Home/info/index/addon/SystemInfo

will be output
Addon SystemInfo
If our plug-in directory is not Addon, but Plugin, then it needs to be defined in the configuration file:

Copy code The code is as follows:
'VAR_ADDON' => 'plugin'

Then the access URL address becomes

Copy code The code is as follows:
http://serverName/Home/info/index/plugin/SystemInfo

Note: Currently, the plug-in controller only supports module plug-in controller access and does not yet support global public plug-ins.

Note: This usage is only for version 3.2.2 downloaded from the official website. Some detailed adjustments will be made in the future, including defining the location of plug-ins and so on.
For more usage, please refer to the subsequent detailed manual.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/963837.htmlTechArticleThinkPHP3.2.2 plug-in controller function, thinkphp3.2.2 plug-in version 3.2.2 starts to support the calling of plug-in controller , you can access a plug-in definition in the module through a more convenient URL address...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!