cakePHP 3 和 Bootstrap-ui App\View\AppView::initialize() 声明

cakePHP 3 and Bootstrap-ui Declaration of App\View\AppView::initialize()

我已经用 composer 安装了 Bootstrap-UI 插件,并在 bootstrap.php.

中加载了插件

当我向 ViewApp.php 添加必要的代码时,出现错误。

Strict (2048): Declaration of App\View\AppView::initialize() should be compatible with Cake\View\View::initialize() [APP/View/AppView.php, line 22]
Code Context
*/
class AppView extends View
{

我添加的代码是:

class AppView extends View
{

    public $layout = 'BootstrapUI.default';

    public function initialize(array $config)
    {
        $this->loadHelper('Html', ['className' => 'BootstrapUI.Html']);
        $this->loadHelper('Form', ['className' => 'BootstrapUI.Form']);
        $this->loadHelper('Flash', ['className' => 'BootstrapUI.Flash']);
        $this->loadHelper('Paginator', ['className' => 'BootstrapUI.Paginator']);
     }

我有同样的问题,我删除了初始化函数中的'array $config'。

public function initialize()
{
   // Code from Plugin
}

您还需要在视图中添加 <?php $this->extend('../Layout/TwitterBootstrap/dashboard'); ?> 以获得 bootstrap 外观。