当我尝试访问localhost
时出现以下错误:
致命错误:未找到“Spyc”类 第37行/var/www/html/wp-content/mu-plugins/wp-config/Config.php
所以Spyc没有加载到应用程序中,当它到达下一行时会抛出错误。
WP-配置/ config.php中
$path = ABSPATH . 'wp-content/mu-plugins/config/';
$secret = file_exists(__DIR__ . '/env.php');
if (file_exists($path . 'config.yml')) {
$config = Spyc::YAMLLoad($path . 'config.yml');
// If there is a secret, then assume the file is encrypted
if ($secret) {
$secret = require_once(__DIR__ . '/env.php');
$encrypter = new \Illuminate\Encryption\Encrypter($secret['key']);
}
但是根据以下documentation,必须在mu-plugins
中创建一个文件,以便加载我所做的依赖项。
μ型插件/亩-autoloader.php
namespace MustUsePlugins;
const PLUGINS = [
'/wp-config/Config.php',
];
for ($i=0; $i < sizeof(PLUGINS); $i++) {
if (file_exists(WPMU_PLUGIN_DIR . PLUGINS[$i]))
require WPMU_PLUGIN_DIR . PLUGINS[$i];
}
但是没有在配置文件中加载依赖项,如下所示:
* Requirements: The plugin doesn't include dependencies. These should be added
* to the root Composer file for the site (composer require ...)
* mustangostang/spyc: ^0.6.2
* illuminate/encryption: ^5.6
*/
namespace Nyco\WpConfig\Config;
/**
* Dependencies
*/
use Spyc;
use Illuminate;
use Exception;
/**
* Constants
*/
const PROTECT = ['WP_ENV']; // List of protected env variables
/**
* Fuctions
*/
我确实将依赖项添加到根Compose文件中,但是加载不成功。
任何帮助?