2.wp-blog-header.php file Analysis (i)

Source: Internet
Author: User
Two. wp-blog-header.php file Analysis (i)
in the previous chapter we know that the index file only makes a declaration confirming the loaded constants, and then contains the Wp-blog-header file

wp-blog-header.php All content
 
  

by the above code we can divide the wp-blog-header.php into three parts.
1. Load the wp-load.php file in the current directory
2. Call WP () function
3. Load the template-loder.php file in the Wp-include directory

We step into the analysis, starting with wp-load.php, this file is very simple, come up to set the root directory and Error reporting method, and then contains wp-config.php this file.


Define (' Abspath ', DirName (__file__). '/' );    The root directory of WordPress///See the root directory of the wp-config.php file exists no, in the inclusion, no longer will be removed from the root of the constant "/" and re-included, and can not be found to enter the installation page. if (File_exists (Abspath. ' wp-config.php ') {      require_once (abspath). ' wp-config.php ');} ElseIf (File_exists (DirName (Abspath). '/wp-config.php ') &&! File_exists (DirName (Abspath). '/wp-settings.php ') {      require_once (dirname (Abspath)). '/wp-config.php ');} else {        //install code, because do not study the installation, temporarily do not write}


we have installed WordPress here by default, So the program should be successfully loaded wp-config.php This file, this file is the database configuration information and identity key, then there is the AH and loaded the Wp-include directory under the wp-setting.php file.

Database information and Identity key is skipped//See, clearly in the wp-load.php file defines the root directory constants, here because to load wp-settings.php and made a second judgment to ensure that accidents occur, we have to learn this rigorous programming habits. if (!defined (' Abspath ')) define (' Abspath ', DirName (__file__). '/');/** set the WordPress variable and the include file. */require_once (Abspath. ' wp-settings.php ');
  • 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.