ThinkPHP3.2.2 plug-in controller features _php tutorials

Source: Internet
Author: User

ThinkPHP3.2.2 plug-in controller function


This article mainly introduces the use of plug-in controller features that ThinkPHP3.2.2 the latest support, very detailed, recommended for small partners.

The 3.2.2 version begins to support the call of the plug-in controller, which can be accessed through a more convenient URL address to a plugin-defined controller in the module.

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:

The code is as follows:


Http://serverName/Home/info/index/addon/SystemInfo


Because the addon parameter is passed in, the user controller here is not the original

The code is as follows:


home/controller/infocontroller.class.php

Instead, it calls the Infocontroller controller of the SystemInfo plug-in (under the Home/addon directory), which is located

The code is as follows:


home/addon/systeminfo/controller/infocontroller.class.php

The plug-in controller itself is defined as the normal access controller, for example:

The code is as follows:


namespace Home\addon\systeminfo\controller;
Class Infocontroller extends \think\controller{
Public Function index () {
Echo ' Addon SystemInfo ';
}
}

In this way, we are visiting

The code is as follows:


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:

The code is as follows:


' Var_addon ' = ' plugin '

Then accessing the URL address becomes

The code is as follows:


Http://serverName/Home/info/index/plugin/SystemInfo

Note: The plug-in controller currently supports only the module's plug-in controller access and does not yet support the global public plug-in.

Note: This usage is only available for the 3.2.2 version downloaded from the official website. Subsequent adjustments will be made to the details, including defining the plug-in location and so on.
For more usage, please refer to the following detailed manual content.

http://www.bkjia.com/PHPjc/963997.html www.bkjia.com true http://www.bkjia.com/PHPjc/963997.html techarticle ThinkPHP3.2.2 Plug-in controller features this article mainly introduces the use of plug-in controller features that ThinkPHP3.2.2 the latest support, very detailed, recommended to small partners. ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.