Php 是否需要WP config运行其他WP命令?
我有一个php网站,我需要连接到我的wordpress网站(他们在同一台服务器上) 因此,我只包含配置文件以打开一个新连接,如:Php 是否需要WP config运行其他WP命令?,php,wordpress,Php,Wordpress,我有一个php网站,我需要连接到我的wordpress网站(他们在同一台服务器上) 因此,我只包含配置文件以打开一个新连接,如: require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-config.php'); 但我得到了一个错误(似乎出于某种原因,它也在运行其他一些wp命令: #0 /home/public_html/wp-includes/class-wp-hook.php(298): call_user_func_array() #1 /home/p
require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-config.php');
但我得到了一个错误(似乎出于某种原因,它也在运行其他一些wp命令:
#0 /home/public_html/wp-includes/class-wp-hook.php(298): call_user_func_array()
#1 /home/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters()
#2 /home/public_html/wp-includes/plugin.php(453): WP_Hook->do_action()
#3 /home/public_html/wp-settings.php(448): do_action()
#4 /home/public_html/wp-config.php(87): require_once()
#5 /home/public_html/myphpsite/protected/modules/contacts/controllers/ContactsController.php(695): require_once()
这里发生了什么
有什么建议吗?谢谢
编辑:WP配置如下
<?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:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/
// ** MySQL settings ** //
/** The name of the database for WordPress */
define('DB_NAME', 'db');
/** MySQL database username */
define('DB_USER','dba');
/** MySQL database password */
define('DB_PASSWORD','asd');
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
/**
* 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
*/
define('AUTH_KEY', '4= 6|5taXSAxeaP/Zdd1(jkuLX(^X;E+L<^Jt^I!5t/]+ulnl?aF,7K*X9[/f_}w');
define('SECURE_AUTH_KEY', '*4vFa=[Lgf6Sva|w^9+3iFVx-0ATu>`>7*9PnT27Os{% 4G,*P(f<xHp|+I5A5u&');
define('LOGGED_IN_KEY', 'B+nC*4!Dn0`CNfXv`8 Y#T<c6%Rpc> 1lI62)4/%st~++_KmCiP]S=HY}nz{{]m|');
define('NONCE_KEY', '8~6fxOX5aF_O?aiv-[(uLwd_^zXvZIKy9q@ygA<VQ9yOcTkk6j*~:{?%wmf&8zT2');
define('AUTH_SALT', '3>YiOmi!-_vZM#3${^5x@hcrvKPD/u?Qu`tw>u)ty^)X}YzQ?%w!C4vV.=;+Ro[q');
define('SECURE_AUTH_SALT', 'Otaj|C=4$.%9jomO|`Z)[K/i:cK*vc^InQ|h]_c+e5%dSdrnnzz2+$|55[(AbmAS');
define('LOGGED_IN_SALT', '!FEtJ~4@dq|*`fXIrIF(zWLKbjI~5<E{h4mIyOm*(C&Q|J#/LVEXgnn|01Fy#=nW');
define('NONCE_SALT', 'D]b9]_|pK!,,,*L*E)4pJCi^E2<8o?2tJ-b~=,Cywqiss$Dg0oZU/[bn2dkx1 m-');
/**
* 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 = 'bbcrmFE_';
define('API_HOST','/api');
define('API_USER','api');
define('API_PASS','api');
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
尝试加载/wp load.php
文件,这里是Wordpress加载访问wp功能所需的所有内容
require_once($_SERVER['DOCUMENT_ROOT'../wp load.php');
编辑:
您的问题之所以会出现,是因为在wp config.php
文件的末尾,它被称为另一个文件wp settings.php
,在它们内部,加载了很多东西
也许,您可以创建另一个文件,类似这样的wp constants.php
并将所有常量放在其中。在wp config.php
中,您只需包含此文件
通过这种方式,您可以更好地共享您的WP站点和其他站点的常量。您可能需要显示WP-config.php的内容,以便更多用户可以帮助您。我不需要任何WP功能,只需要WP-configOk的内容,我理解。您的问题是,因为在WP-config.php
文件的末尾,它被称为other文件wp settings.php
,其中加载了很多东西。谢谢,我错过了那个!谢谢!