Load the basic file
cake/basics.php which defines commonly used methods and time constants
$TIME_START = getMicrotime(); records the start execution time
cake/config/paths.php which defines some basic paths
cake/lib/object.php The basic class of cake
cake/lib/inflector.php here mainly deals with singular and plural numbers, underlined naming and camel case naming
cake/lib/configure.php inside Provides file configuration reading and writing, path setting, and file loading methods
cake/lib/cache.php cache operations
Configure::getInstance(); Start configuring the project
Configuration file of the config/core.php project
config/bootstrap.php Entry file of the project
App::import('Core', array('Dispatcher')); Load the core and start doing business Now, GO
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch($url); starts execution by parsing the current url. If you set up compressed Js and Css, then these The file is compressed and output. If you set a cache for the page, the cached page will be output directly, and finally the corresponding Controller will be found. If it cannot be found, appropriate error handling is performed.
Instantiate the current Controller, determine the view path, instantiate the Component, and obtain the method of only the current Controller [not including the parent class Controller]
Protect the private methods, methods with admin routing or prefix in the current Controller. Direct access is not allowed
to set the basic properties of the current Controller, such as base, here, webroot, plugin, params, action, passedArgs[array_merge($this->params['pass'],$this->params[ 'named'])]
Call the constructClasses method in Controller
Execute the __mergeVars method, which performs special merging processing of components, helpers, uses and other attributes of parent and child classes
Call Component->init( ) method, loads the series components set by the user (Session is the default), and the default enabled attribute is true. (This property can be modified later in beforeFilter)
Call the Component->initialize() method. If there is this initialize method in the series components and the component's enabled is true, then call the components->initialize method (here It seems that the enabled user cannot be set through the Controller, it can only be true)
Call the beforeFilter() method in the current Controller, this method is a good thing^_^
Call the Component->startup() method, similarly, if the series If there is this startup method in components and the component's enabled is true, then the components->startup method is called (enabled here can be set through beforeFilter). This method is also the most important method in components. For example, Auth is making a big fuss here. ^_^
Start executing the Action method in the current Controller
If autoRender is set to true, call the render() method of the current Controller, otherwise return or output the data returned by the Action method
Call the Controller's When rendering() method, first call the beforeRender() method in the current Controller
Load the view rendering class
Call the Component->beforeRender() method. Similarly, if there is this beforeRender method in the series components and the component's If enabled is true, call the components->beforeRender method (enabled here can be set through beforeFilter)
Get the data validation error information of the current Model, and use it for View
Calling the render() method of View
to load Enter the relevant Helper
Call the Helper's beforeRender() method
Call the Helper's afterRender() method
Related cache processing
Execute the renderLayout() method, of course, the premise is that you must allow rendering layout, the default is The default.ctp layout file
calls the Helper's beforeLayout() method
calls the Helper's afterLayout() method
calls the Component->shutdown() method. Similarly, if there is this shutdown method in the series components and the If the component's enabled is true, call the components->shutdown method (enabled here can be set through beforeFilter)
Execute the afterFilter method in the current Controller, here you can modify the output content of the view ($controller->output) Do some processing
Return or output the view data.
The process is completed.