Php 如何安装Yiistrap?我得到了CException属性“;CUrlManager.bootstrap“;没有定义

Php 如何安装Yiistrap?我得到了CException属性“;CUrlManager.bootstrap“;没有定义,php,css,yii,installation,cexception,Php,Css,Yii,Installation,Cexception,我刚刚安装了yii框架,然后尝试在其上安装yiistrap。我遵循指南: 和 但也有同样的错误: CEException 未定义属性“CUrlManager.bootstrap” 我使用yii-bootstrap-0.9.12.r211,正如在一篇会员帖子上建议的那样,但它仍然不起作用 我做了3次修改: 内部扩展/bootstrap/components/bootstrap.php public function init() { $this->registerAllCss();

我刚刚安装了yii框架,然后尝试在其上安装yiistrap。我遵循指南: 和

但也有同样的错误: CEException 未定义属性“CUrlManager.bootstrap”

我使用yii-bootstrap-0.9.12.r211,正如在一篇会员帖子上建议的那样,但它仍然不起作用

我做了3次修改:

内部扩展/bootstrap/components/bootstrap.php

public function init() {
    $this->registerAllCss();
    $this->registerJs();
    parent::init();
}
在config/main.php内部

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.

Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

return array(
    ...

    'theme'=>'bootstrap',
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),                      
        ),
    ),

    // preloading 'log' component
    'preload'=>array('log'),

    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
        'bootstrap.helpers.TbHtml',
    ),

    'modules'=>array(
        // uncomment the following to enable the Gii tool
        'gii'=>array(
            ...
          ),
    ),

    // application components
    'components'=>array(

        'user'=>array(
            // enable cookie-based authentication
            'allowAutoLogin'=>true,
        ),

        // uncomment the following to enable URLs in path-format
        'urlManager'=>array(
            'urlFormat'=>'path',
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),

        'bootstrap'=>array(
        'class'=>'bootstrap.components.Bootstrap',
            ),

        ),

                // database settings are configured in database.php
        'db'=>require(dirname(__FILE__).'/database.php'),

        'errorHandler'=>array(
            // use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),

        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                // uncomment the following to show log messages on web pages
                /*
                array(
                    'class'=>'CWebLogRoute',
                ),
                */
            ),
        ),

    ),

    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params'=>array(
        // this is used in contact page
        'adminEmail'=>'webmaster@example.com',
    ),
);


请帮我节省时间。谢谢。

您已经在url管理器数组中定义了
'bootstrap'
。这是不正确的。您应该这样做:

'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    ),

'bootstrap'=>array(
    'class'=>'bootstrap.components.Bootstrap',
 ),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'规则'=>数组(
“/”=>“/视图”,
'//'=>'/',
'/'=>'/',
),
),
'引导'=>阵列(
'class'=>'bootstrap.components.bootstrap',
),

谢谢@hamed,第一个障碍消失了,但第二个障碍出现了。我得到了新的CEException:

别名“bootstrap.components.TbApi”无效。确保它指向现有的PHP文件并且该文件可读
正如stackoverflow.com/questions/21641401/…上建议的那样,我在config/main.php中添加了

导入=>数组(…'bootstrap.helpers.*'、'bootstrap.widgets.*'、'bootstrap.behaviors.',),

。有什么想法吗?Tx before–谢谢@hamed,第一个障碍消失了,但第二个障碍出现了。我得到了新的CException:
别名“bootstrap.components.TbApi”无效。确保它指向现有的PHP文件并且该文件可读如何解决此问题?
'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    ),

'bootstrap'=>array(
    'class'=>'bootstrap.components.Bootstrap',
 ),