【发布时间】:2018-11-29 20:09:33
【问题描述】:
我正在尝试在新设置的应用程序上设置 CakeDC/用户。 我已更改 app.php 配置文件以指向正确的数据库(有效) 从 CMD 我做了以下事情:
cd c:\xampp\htdocs
php composer.phar create-project --prefer-dist cakephp/app MyAppName
cd c:\xampp\htdocs\MyAppName
php composer.phar require cakedc/users
然后在bootstrap.php中:
Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);
(我没有使用任何社交媒体)
然后在 AppcController.php 中
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler', ['enableBeforeRedirect' => false]);
$this->loadComponent('Flash');
$this->loadComponent('CakeDC/Users.UsersAuth');
}
最后,当我运行应用程序(使用 XAMPP 和 Apache)时,出现错误,似乎是说 cakephp 找不到插件控制器文件,因为它在错误的位置:
Could not load configuration file: C:\xampp\htdocs\MyAppName\config\users.php
Cake\Core\Exception\Exception
Documentation API
If you want to customize this error message, create src\Template\Error\error500.ctp
toggle vendor stack frames
⟩ Cake\Core\Configure\Engine\PhpConfig->_getFilePath
CORE\src\Core\Configure\Engine\PhpConfig.php, line 86
⟩ Cake\Core\Configure\Engine\PhpConfig->read
CORE\src\Core\Configure.php, line 324
⟩ Cake\Core\Configure::load
ROOT\vendor\cakedc\users\config\bootstrap.php, line 22
⟩ Cake\Core\Plugin::{closure}
CORE\src\Collection\CollectionTrait.php, line 51
⟩ Cake\Collection\Collection->each
ROOT\vendor\cakedc\users\config\bootstrap.php, line 23
⟩ include
CORE\src\Core\Plugin.php, line 418
⟩ Cake\Core\Plugin::_includeFile
CORE\src\Core\Plugin.php, line 327
⟩ Cake\Core\Plugin::bootstrap
CORE\src\Core\Plugin.php, line 183
⟩ Cake\Core\Plugin::load
ROOT\config\bootstrap.php, line 211
⟩ require_once
CORE\src\Http\BaseApplication.php, line 145
⟩ Cake\Http\BaseApplication->bootstrap
APP/Application.php, line 37
⟩ App\Application->bootstrap
CORE\src\Http\Server.php, line 121
⟩ Cake\Http\Server->bootstrap
CORE\src\Http\Server.php, line 82
⟩ Cake\Http\Server->run
ROOT\webroot\index.php, line 40
好像是说在app/config文件夹下找不到users.php,其实是因为在插件的config文件夹下。
有没有人遇到过这个问题,并且可以提出我做错了什么。我确信这很简单,而且很愚蠢(就我而言)。
谢谢
【问题讨论】: