编辑文件:wp-config.php
<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the installation. * You don't have to use the web site, you can copy this file to "wp-config.php" * and fill in the values. * * This file contains the following configurations: * * * Database settings * * Secret keys * * Database table prefix * * Localized language * * ABSPATH * * @link https://wordpress.org/support/article/editing-wp-config-php/ * * @package WordPress */ // ** Database settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'yinbomfg' ); /** Database username */ define( 'DB_USER', 'yinbomfg' ); /** Database password */ define( 'DB_PASSWORD', 'cdcNGf8TBZWtGDYJ' ); /** Database hostname */ define( 'DB_HOST', '127.0.0.1' ); /** Database charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8mb4' ); /** The database collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); /**#@+ * Authentication unique keys and salts. * * Change these to different unique phrases! You can generate these using * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}. * * You can change these at any point in time to invalidate all existing cookies. * This will force all users to have to log in again. * * @since 2.6.0 */ /* * 认证密钥与盐值(secret keys & salts)已移至 wp-config-local.php(不入版本库, * 见 .gitignore)。该文件含敏感信息,每套环境独立,部署后请重新生成并替换: * https://api.wordpress.org/secret-key/1.1/salt/ * 文件缺失时回退 WordPress 默认盐值(前台会提示),不会致命错误。 */ $cb_local_config = __DIR__ . '/wp-config-local.php'; if ( file_exists( $cb_local_config ) ) { define( 'WP_CONFIG_LOADING', true ); // marker so wp-config-local.php can block direct browser access. require_once $cb_local_config; } /**#@-*/ /** * WordPress database table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /* Add any custom values between this line and the "stop editing" line. */ /** * 让站点地址随当前访问域名自适应(覆盖数据库里写死的 siteurl/home)。 * 常量优先级高于 wp_options 的 siteurl/home,home_url() 即按当前域名生成, * 整站链接(菜单 / Hero / 分类卡 / 商品卡 / Inquire / 语言切换)不再指向旧域名导致 404; * 部署/迁移到任何域名都无需手动改库。CLI / wp-cron 等无 HTTP 上下文时不定义,回退到数据库值。 * * 安全(防 Host 头注入 / 缓存投毒 / 域名劫持):只在 host 命中白名单时才按当前域名生成 * WP_HOME。白名单 = 生产域名(www.yinbomfg.com / yinbomfg.com) + 本地开发域名 * (localhost / 纯 IP / *.local / *.test / *.localhost)。其余 host 一律回退数据库值。 */ if ( ! defined( 'WP_HOME' ) && isset( $_SERVER['HTTP_HOST'] ) ) { $cb_host = strtolower( $_SERVER['HTTP_HOST'] ); $cb_port = $_SERVER['HTTP_X_FORWARDED_PORT'] ?? $_SERVER['SERVER_PORT'] ?? ''; $cb_is_ssl = ( ! empty( $_SERVER['HTTPS'] ) && 'off' !== $_SERVER['HTTPS'] ) || '443' === (string) $cb_port || ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ); $cb_scheme = $cb_is_ssl ? 'https' : 'http'; $cb_prod_hosts = array( 'www.yinbomfg.com', 'yinbomfg.com' ); $cb_is_local = ( 'localhost' === $cb_host ) || ( false !== filter_var( $cb_host, FILTER_VALIDATE_IP ) ) || ( (bool) preg_match( '/\.(local|test|localhost)$/i', $cb_host ) ); if ( in_array( $cb_host, $cb_prod_hosts, true ) || $cb_is_local ) { define( 'WP_HOME', $cb_scheme . '://' . $cb_host ); define( 'WP_SITEURL', $cb_scheme . '://' . $cb_host ); } } define( 'WP_DEBUG_DISPLAY', false ); // 不向前台暴露错误(即使 WP_DEBUG 开启) define( 'DISALLOW_FILE_EDIT', true ); // 禁用后台主题/插件文件编辑器(防提权) // 完全禁用后台插件/主题安装与更新(含语言包安装,也禁用 WP 自动更新)。 // 当前注释保留:10 语言铺开需安装语言包、Rank Math 配置等后台写文件操作, // 完成后台清单后取消注释以加固生产环境: // define( 'DISALLOW_FILE_MODS', true ); define( 'FS_METHOD', 'direct' ); // 本地环境直接写文件,免 FTP 凭证提示 define( 'WP_MEMORY_LIMIT', '256M' ); // WooCommerce 推荐最低 256M define( 'WP_MAX_MEMORY_LIMIT', '512M' ); // 后台任务内存上限 define( 'AUTOSAVE_INTERVAL', 300 ); // 自动保存间隔(秒),减少写库频率 define( 'WP_POST_REVISIONS', 3 ); // 每篇最多 3 个修订版,避免库臃肿 /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the documentation. * * @link https://wordpress.org/support/article/debugging-in-wordpress/ */ if ( ! defined( 'WP_DEBUG' ) ) { define( 'WP_DEBUG', false ); } /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
保存
返回