标签:word dev require custom password load 输入 web def
自动化搭建开发环境、测试、部署如通过网页操作(访问 /wp-admin/install.php
)相对比较麻烦且在有的场景无法实现。
wp-config.php
配置 wordpress 的数据库信息。wp-config.php
同级的目录新建custom_install.php
,输入如下代码:<?php
define( ‘WP_INSTALLING‘, true );
/** Load WordPress Bootstrap */
require_once( dirname( __FILE__ ) . ‘/wp-load.php‘ );
/** Load WordPress Administration Upgrade API */
require_once( ABSPATH . ‘wp-admin/includes/upgrade.php‘ );
/** Load WordPress Translation Install API */
require_once( ABSPATH . ‘wp-admin/includes/translation-install.php‘ );
/** Load wpdb */
require_once( ABSPATH . WPINC . ‘/wp-db.php‘ );
define(‘WP_SITEURL‘, ‘http://localhost/wordpress‘);
$weblog_title = ‘develop‘;
$user_name = ‘zhaofeng_shu33‘;
$admin_email = ‘616545598@qq.com‘;
$public = 1;
$admin_password = ‘random_generation_of_password‘; // in plain text
$loaded_language = ‘‘;
$result = wp_install($weblog_title, $user_name, $admin_email, $public, ‘‘, wp_slash( $admin_password ), $loaded_language);
print_r($result);
?>
注意在以上设置用户名和密码。
php custom_install.php
即可完成wordpress数据库的初始化。标签:word dev require custom password load 输入 web def
原文地址:https://www.cnblogs.com/zhaofeng-shu33/p/10199764.html