We have a preliminary understanding of Yaf through the previous study, but many times we still have no way to start. we may be able to understand the previous sample code, but it is still difficult to write our own code, this is because we are not familiar with the Yaf built-in classes. to build our projects, we must first fully understand the Yaf built-in classes. Now we will summarize the Yaf built-in classes one by one. We have a preliminary understanding of Yaf through the previous study, but many times we still have no way to start. we may be able to understand the previous sample code, but it is still difficult to write our own code, this is because we are not familiar with the Yaf built-in classes. to build our projects, we must first fully understand the Yaf built-in classes. Now we will summarize the Yaf built-in classes one by one.
Important Yaf built-in classes include: Yaf_Application
Yaf_Bootstrap_Abstract
Yaf_Loader
Yaf_Dispatcher
Yaf_Plugin_Abstract
Yaf_Registry
Yaf_Controller_Abstract
Yaf_Action_Abstract
Yaf_View_Interface
Yaf_Request_Abstract
Yaf_Response_Abstract
Yaf_Router
Yaf_Exception
Start learning Yaf_Application
Yaf_Application is a built-in class we first came into contact with. we have seen it in the portal file. Yaf_Application represents a product/project and is the leader in Yaf operation. it is the real execution topic. it is responsible for receiving requests, coordinating routing, distribution, execution, and output.
Yaf_Application Overview [php] view plaincopyfinal Yaf_Application {/* attribute */protected $ config; protected $ dispatcher; protected static $ _ app; protected $ _ modules; protected $ _ running; protected $ _ environ;/* method */public static void app (void) public void bootstrap ([Yaf_Bootstrap_Abstract $ bootstrap]) public Yaf_Application clearLastError (void) private void _ clone (void) public _ constru Ct (mixed $ config [, string $ envrion]) public void _ destruct (void) public void environ (void) public void execute (callable $ entry, string $ ...) public Yaf_Application getAppDirectory (void) public Yaf_Config_Abstract getConfig (void) public Yaf_Dispatcher getDispatcher (void) public string getLastErrorMsg (void) public int getLastErrorNo (void) public array getModules) Public void run (void) public Yaf_Application setAppDirectory (string $ directory) private void _ sleep (void) private void _ wakeup (void)} Yaf_Application member method list Yaf_Application :: app-get the current Yaf_Application instance Yaf_Application: bootstrap-call bootstrap Yaf_Application: clearLastError-clear the final error message Yaf_Application ::__ clone-Yaf_Application cannot be cloned Yaf_Application :: __construct-Yaf_Application structure Create the Yaf_Application ::__ destruct-destructor Yaf_Application: environ-get the environment name of the current Yaf_Application: execute-run the callback function Yaf_Application :: getAppDirectory-get the application directory Yaf_Application: getConfig-get the Yaf_Config_Abstract instance Yaf_Application: getDispatcher-get the latest error message Yaf_Application: getLastErrorMsg-get the Yaf_Application :: getLastErrorNo-get the final error code Yaf_Application: getMod Ules-obtain the module Yaf_Application: run stated in the configuration file and run Yaf_Application: setAppDirectory-change the application directory Yaf_Application ::__ sleep-Yaf_Application cannot be serialized Yaf_Application :: __wakeup-Yaf_Application cannot be deserialized. Several of the most important member methods have been used before, such as app, bootstrap, execute, getDispatcher, and run. These are also the most commonly used ones. we can see the other ones through the manual.