我需要一个函数,自动生成和返回盐的Wordpress wp配置。php(不要将我链接到他们的API,我正在寻找脱机解决方案)。
Wordpress core是否在某处定义了此功能?如果没有,这些盐是否可以随机生成,或者是否有创建它们的特定规则?
编辑:This is what I ended up with:
$keys = array(\'AUTH_KEY\', \'SECURE_AUTH_KEY\', \'LOGGED_IN_KEY\',
\'NONCE_KEY\', \'AUTH_SALT\', \'SECURE_AUTH_SALT\', \'LOGGED_IN_SALT\', \'NONCE_SALT\');
$salts = \'\';
foreach ($keys as $key) {
$salt = wp_generate_password(64, true, true);
$spaces = str_repeat(\' \',16 - strlen($key));
$salts .= "define(\'{$key}\',{$spaces}\'{$salt}\');\\n";
}
输出为字符串:
define(\'AUTH_KEY\', \'f@5^8(OyZLS%+~LNQ6,w(Zpn`3X#A}o4t2LQuqc=x4vn+ b}xYM>TlSwB`|E;}PA\');
define(\'SECURE_AUTH_KEY\', \'vEEF@-c_`VO!d{s)_Nv^uS,)eg9{;60.$nU370/9E1z}O#iu)wkPrw8sh[TqGdC;\');
define(\'LOGGED_IN_KEY\', \'9:z95.y<_LhUnGlH>6%)/-szx8Dwj{z`#mz-C%taXoD:KK86k(?K-f{w]U5w(41v\');
define(\'NONCE_KEY\', \'?YP2djRHOn7[4n[p(KwmX#u.#^s3Fel%AKu@Ac,(L$1DM^@6NNk@x&B/w2/<an:@\');
define(\'AUTH_SALT\', \'$r>m{8@l?xDv<^uNz^.|<Am2}J3q(OMAS<dLB({66M)zy2ufOP8$x*{:US|7PL4x\');
define(\'SECURE_AUTH_SALT\',\'Nn4uU#rIe}7CaXw=Z?pk82Cqo8{ALC6McPHYq_G{><]_YWhHlEuk?`tJ6G[)D$)A\');
define(\'LOGGED_IN_SALT\', \'YLiGuP$DPKP-F3UGw(0#E0L1w;HO0L_Hkt6.(*92t*B6Mclq*`{OO[xM$3)]^9yi\');
define(\'NONCE_SALT\', \'{hh3bpLu$b:e8-uXiCx(3FaK3Q4[`/Mji}~<.cz8W#_a0[O!{h;Fm{^c]p>./RF{\');