ThinkPHP32 loading process (1)

Source: Internet
Author: User
Tags constant definition
: This article mainly introduces the loading process of ThinkPHP32 (1). If you are interested in the PHP Tutorial, refer to it. Loading process (official introduction ):

  1. User URL request
  2. Call the app portal file (usually the index. php of the website)
  3. Load the framework entry File (ThinkPHP. php)
  4. Record the initial running time and memory overhead
  5. System constant judgment and definition
  6. Load the framework bootstrap class (Think \ Think) and execute the Think: start method to initialize the application.
  7. Set error handling and automatic loading
  8. Call the Think \ Storage class for Storage initialization (the Storage type is defined by the STORAGE_TYPE constant)
  9. In deployment mode, if an application compilation cache file exists, load the file directly (directly jump to step 22)
  10. Read the definition file of the application mode (defined by the APP_MODE constant) (The following uses the normal mode as an example)
  11. Load the core file defined in the current application Mode (the normal Mode is ThinkPHP/Mode/common. php)
  12. Load the convention configuration file (the normal mode is ThinkPHP/Conf/convention. php)
  13. Load the Application configuration file (the Common mode is Application/Common/Conf/config. php)
  14. Load System alias definition
  15. Judge and read the Application alias definition file (the normal mode is Application/Common/Conf/alias. php)
  16. Load System behavior definitions
  17. Determine and read the Application behavior definition file (the normal mode is Application/Common/Conf/tags. php)
  18. Load the underlying language pack of the framework (normal mode is ThinkPHP/Lang/zh-cn.php)
  19. If the deployment mode is used, the application compilation cache file is generated.
  20. Load the debugging mode system configuration file (ThinkPHP/Conf/debug. php)
  21. Judge and read the debugging configuration file of the Application (default value: Application/Common/Conf/debug. php)
  22. Judge the application status and read the status configuration file (if the APP_STATUS constant definition is not empty)
  23. Check the application directory structure and generate it automatically (if the CHECK_APP_DIR configuration is enabled and the RUNTIME_PATH directory does not exist)
  24. Call the run method of the Think \ App class to start the application.
  25. App initialization (app_init) tag bit listens and executes binding behavior
  26. Judge and load dynamic configuration and function files
  27. Call Think \ Dispatcher: dispatch to schedule URL requests
  28. Automatically identifies the $ _ SERVER ['path _ info'] parameter under the compatible URL mode and command line mode
  29. Deploy the detection domain name and bind the module and controller (the APP_SUB_DOMAIN_DEPLOY parameter is enabled)
  30. Analyze the PATH_INFO information in the URL
  31. Obtain the requested module information
  32. Check whether the module exists and allows access
  33. Determine and load module configuration files, alias definitions, behavior definitions, and function files
  34. Judge and load the dynamic configuration and function file of the module
  35. Module URL mode judgment
  36. Module route detection (enabled by URL_ROUTER_ON)
  37. PATH_INFO (path_info) tag bit listening and binding
  38. URL suffix detection (URL_DENY_SUFFIX and URL_HTML_SUFFIX processing)
  39. Obtain the current controller, operations, and other URL parameters.
  40. URL request scheduling (url_dispatch) tag bit listening and binding behavior
  41. Application start (app_begin) tag bit listens and executes binding behavior
  42. Call SESSION_OPTIONS to configure parameters for Session initialization (if not in command line mode)
  43. Execute controller method based on request
  44. If the controller does not exist, check whether the empty controller exists.
  45. The controller starts listening to the tag bit (action_begin) and executes the binding action.
  46. By default, the system's ReadHtmlCache behavior is called to read the static cache (the HTML_CACHE_ON parameter is enabled)
  47. Determine and call the controller's _ initialize initialization method
  48. Determines whether an operation method exists. if not, checks whether empty operation methods are defined.
  49. Determine whether the pre-operation method is defined. If yes, execute
  50. Action parameter binding detection: automatically matches parameters of the operation method
  51. If template rendering is available (call the controller display method)
  52. View start (view_begin) tag bit listens and executes binding behavior
  53. Call the fetch method of Think \ View to parse and obtain the template content
  54. Automatically identifies the current topic and locates the template file
  55. View parsing (view_parse) tag bit listens and executes binding behavior
  56. Default call built-in ParseTemplate behavior parsing template (below normal mode)
  57. The template engine parses the template content and generates the template cache.
  58. Template_filter listens to and performs binding
  59. By default, the ContentReplace action of the system is called to replace the template.
  60. The output content filtering (view_filter) tag bit listens and executes binding behavior
  61. By default, the system's WriteHtmlCache behavior is called to write data to the static cache (the HTML_CACHE_ON parameter is enabled)
  62. Call the render method of the Think \ View class to output the rendering content.
  63. View end (view_end) tag bit listens and executes binding behavior
  64. Determine whether the post operation method is defined. If yes, execute
  65. Controller ends (action_end) tag bit listening and executes binding behavior
  66. App_end tag listening and binding
  67. Execute the ShowPageTrace action of the system (the SHOW_PAGE_TRACE parameter is enabled and is not an AJAX request)
  68. Write log information storage

Code:

1. entry File (index. php)

// Check the PHP environment if (version_compare (PHP_VERSION, '5. 3.0 ',' <') die ('require PHP> 5.3.0! '); // Enable the debugging mode. it is recommended that you enable the annotation of the deployment phase in the development phase or set it to falsedefine ('app _ debug', True ); // define the application directory define ('app _ path ','. /Application/'); // introduce the ThinkPHP entry file require '. /ThinkPHP. php ';

Purpose 1. set whether the debug mode is used. (in debug mode, that is, when APP_DEBUG is set to True, the last compiled value is not loaded ~ In runtime. php development, we recommend that you start the debugging mode)

2. define the APP_PATH path

3. it is also the most important entry to introduce ThinkPHP. this is the start of the complex and simple TP framework tour. if you do not have any equipment, you can bring the equipment, click the TP framework.

The following describes how the page appears without modifying the TP source code.

(PS: because the monks are also the first to learn the TP framework. They are also the first to learn PHP. they hope to write some of their own experiences here and organize their own ideas. They also hope to help everyone raise their own ideas if they have any mistakes.)

The above introduces ThinkPHP32 loading process (I), including some content, and hope to be helpful to friends who are interested in PHP tutorials.

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.