The A method of thinkphp is used to instantiate the controller internally, and its invocation format is:
A (' [Project://][Group/] module ', ' Controller layer name ')
The simplest usage:
$User = A (' User ');
Represents the Useraction controller that instantiates the current project (the file that corresponds to this controller is located in lib/action/useraction.class.php), if the grouping mode is used, and the controller to instantiate another admin group can be used:
$User = A (' Admin/user ');
Cross-project instantiation is also supported (the catalog of the project is to remain sibling)
$User = A (' Admin://user ');
Represents the Useraction controller under the instantiation Admin Project
The 3.1 version of thinkphp adds support for layered controllers, so you can also instantiate other controllers with a method , such as:
$User = A (' User ', ' Event ');
Instantiate the Userevent controller (the corresponding file is located in lib/event/userevent.class.php).
After instantiating the controller, you can call the methods in the controller, but it is important to note that, in the case of cross-project invocation, if your action method has a special variable operation for the current controller, there will be some unknown issues, so, in general, the official recommendation requires a public call of the controller layer developed separately, Don't have too many dependencies.
http://www.bkjia.com/PHPjc/825505.html www.bkjia.com true http://www.bkjia.com/PHPjc/825505.html techarticle The thinkphp a method is used to instantiate the controller internally, with the following invocation format: A (' [Project://][/] module ', ' Controller layer name ') The simplest usage: $User = A (' User ');