初学者:cakephp 3.6安装cakedc /用户

时间:2018-06-20 15:59:50

标签: php cakephp cakedc

我正在尝试在全新设置的App上设置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文件夹中。

有人遇到过这个问题,可以提出我做错了什么。我确信这是一件简单而愚蠢的事情(对我而言)。

谢谢

2 个答案:

答案 0 :(得分:0)

删除此行Configure::write('Users.config', ['users']);或添加您自己的users.php配置,并在需要时添加替代。

https://github.com/CakeDC/users/blob/master/Docs/Documentation/Installation.md#customization

处查看相关文档条目

答案 1 :(得分:0)

作为示例,您可以复制原始user.php

cp -i vendor/cakedc/users/config/users.php config/

在我的bootstrap.php中,我有这个

Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);