Object Top class
Class object
First level abstract class controller
Abstract class Controller extends object
Second level abstract class Controller_abstract inherit controller grandfather class
Abstract class Controller_abstract extends controller
cmstop.php Main Program
Set property public $app, $controller, $action
The module, controller, and method used to receive and save the current request
Instantiate the object,
$obj = new $this->class ($this);
Instantiate the $this in cmstop.php.
The $this->controller= content that was received this time
So. Instantiate the content class, calling the method execute () when it is not. Just look in the parent class.
$response = $obj->execute ();
The Execute method is in the parent class Controller_abstract
All current controllers. are inherited from this parent class abstract class Controller_abstract
The $this in the parent class is the class name Controller_admin_content
(attribute $this->controller= content when instantiated)
The $this->app of the parent class is when it is instantiated. All properties that contain values
The $this->app->action of the parent class is the Action property in all properties
Abstract the role of the parent class:
if ($this->action_exists ($this->app->action))//Determine if the current class exists a method exists let him run: Call him.
User--The method--array
{
$response = Call_user_func_array (Array ($this, $this->app->action), $this->app->args);
}
This ensures that the. $_get passes over what controller. Cmstop is the controller to instantiate.
And call the object's parent class in the abstract class method, $response = $obj->execute ();
At the time of instantiation. What is the controller. What method. Call the Controller and method
Call_user_func_array (Array ($this, $this->app->action)
Defining common properties in the main program
Class Cmstop extends Object
Public $app, $controller, $action
Receive parameters for user requests
$this->app = ' system ';
$this->controller = ' content ';
$this->action = ' index ';
Instantiate $this. is to pass these attributes as parameters to the Controller_admin_content class. and trigger the constructor method.
$obj = new $this->class ($this);
Passed to the parent class's constructor,
Parent class checks for the presence of a requested method
if ($this->action_exists ($this->app->action))
There, call him.
$response = Call_user_func_array (Array ($this, $this->app->action), $this->app->args);
$obj = new $this->class ($this);
When instantiated. 2 things have been done.
1 instantiate the Controller class in this attribute.
2 The property value as an argument, passed to the constructor of the class, and then passed to the constructor of the parent class
Class Controller_admin_content extends Controller_abstract
function __construct (& $app)
{
Parent::__construct ($app);
}
Cmstop what controllers and methods are passed---instantiate the controller