wp项目setting文件部分代码解析

刚接触wp,以下内容的注解可能会有不到位的地方,仅作参考:
define( 'WPINC', 'wp-includes' );//定义include文件夹目录
// Include files required for initialization.
require( ABSPATH . WPINC . '/load.php' );//加载常用函数文件
require( ABSPATH . WPINC . '/default-constants.php' );
require( ABSPATH . WPINC . '/version.php' );//版本参数信息文件
// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
wp_initial_constants( );//初始化常量信息
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();//检查php、mysql的版本信息和扩展是否符合,不符合打印提示信息
// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
set_magic_quotes_runtime( 0 );//不设置自动转义
@ini_set( 'magic_quotes_sybase', 0 );//设置magic_quotes_sybase变量为0
// Set default timezone in PHP 5.
if ( function_exists( 'date_default_timezone_set' ) )
date_default_timezone_set( 'PRC' );
// Turn register_globals off.
wp_unregister_GLOBALS();//注销全局变量信息
// Ensure these global variables do not exist so they do not interfere with WordPress.
unset( $wp_filter, $cache_lastcommentmodified );//注销变量
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();//设置服务器变量$_SERVER['REQUEST_URI']、$_SERVER['PHP_SELF']
// Check if we have received a request due to missing favicon.ico
wp_favicon_request();//
// Check if we're in maintenance mode.
wp_maintenance();//判断网站是否在维护状态,是就输出正在维护中的提示信息
// Start loading timer.
timer_start();//记时开始
// Check if we're in WP_DEBUG mode.
wp_debug_mode();//是否在调试模式
// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
if ( WP_CACHE )
WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
// Define WP_LANG_DIR if not set.
wp_set_lang_dir();//设置语言包路径
// Load early WordPress files.
require( ABSPATH . WPINC . '/compat.php' );//php版本不同确认函数兼容,没有则重写函数
require( ABSPATH . WPINC . '/functions.php' );//函数库
require( ABSPATH . WPINC . '/class-wp.php' );//类库
require( ABSPATH . WPINC . '/class-wp-error.php' );//错误信息类
require( ABSPATH . WPINC . '/plugin.php' );//插件函数
// Include the wpdb class and, if present, a db.php database drop-in.
require_wp_db();//数据库连接
// Set the database table prefix and the format specifiers for database table columns.
wp_set_wpdb_vars();//数据库信息检查和设置
// Start the WordPress object cache, or an external object cache if the drop-in is present.
wp_start_object_cache();//开始使用对象缓存,或外部对象如果在目前缓存
// Load early WordPress files.
require( ABSPATH . WPINC . '/default-filters.php' );
require( ABSPATH . WPINC . '/pomo/mo.php' );
// Initialize multisite if enabled.是否是多站
if ( is_multisite() ) {
require( ABSPATH . WPINC . '/ms-blogs.php' );
require( ABSPATH . WPINC . '/ms-settings.php' );
} elseif ( ! defined( 'MULTISITE' ) ) {
define( 'MULTISITE', false );
}

Words translated by CCJK

146,096,379

We are Certified

Our Client Satisfaction

rating for previous quarte

4.00

Over 95% of our clients recommend our language services to others


Copyright © CCJK Technologies Co., Ltd. 2000-2017. All rights reserved.
TOP