带引导扩展名的Yii,别名“Yii”;bootstrap.widgets.TbNavbar“;这是无效的。确保它指向现有的PHP文件

带引导扩展名的Yii,别名“Yii”;bootstrap.widgets.TbNavbar“;这是无效的。确保它指向现有的PHP文件,php,twitter-bootstrap,yii,Php,Twitter Bootstrap,Yii,我正在尝试使用yii,但我不断得到标题中提到的错误,我仔细检查了我的配置文件,但我不知道我哪里做错了。这是我的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 wri

我正在尝试使用yii,但我不断得到标题中提到的错误,我仔细检查了我的配置文件,但我不知道我哪里做错了。这是我的
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.
return array(
        'language'=>'en_us',
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'CODEPAC',

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

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

        ),

        'modules'=>array(
                // uncomment the following to enable the Gii tool
                'user'=>array(
                'debug'=>false,
                'userTable'=>'user',
                'translationTable'=>'translation',
                'mailer'=>'PHPMailer',
                'facebookConfig'=>array(
                        'appId'=>'12345',
                        'secret'=>'secret',
                        'domain'=>'localhost',
                        'status'=>true,
                        'xfbml'=>true,
                        'cookie'=>true,
                        'lang'=>'en_US',)
                ),
                 'avatar'=>array(),

                'profile' => array(
                'privacySettingTable' => 'privacysetting',
                'profileFieldTable' => 'profile_field',
                'profileTable' => 'profile',
                'profileCommentTable' => 'profile_comment',
                'profileVisitTable' => 'profile_visit',
                 ),
                 'role' => array(
                'roleTable' => 'role',
                'userRoleTable' => 'user_role',
                'actionTable' => 'action',
                'permissionTable' => 'permission',
                 ),

                'registration' => array(
                 ),


                'gii'=>array(
                        'class'=>'system.gii.GiiModule',
                        'password'=>'password',
                        // If removed, Gii defaults to localhost only. Edit carefully to taste.
                        'ipFilters'=>array('127.0.0.1','::1'),
                        'generatorPaths'=>array('bootstrap.gii',),
                ),

        ),

        // application components
        'components'=>array(
                'bootstrap'=>array(
                'class'=>'ext.bootstrap.components.Bootstrap',),
                'session'=>array(
                'sessionName'=>'SiteSession',
                'class'=>'CHttpSession',
'autoStart'=>true,
                ),
                 'cache'=>array('class'=>'system.caching.CFileCache'),
                        'user'=>array(
                        'class'=>'application.modules.user.components.YumWebUser',
                        // enable cookie-based authentication
                        'allowAutoLogin'=>true,
                         'loginUrl'=>array('//user/user/login'),
                ),
                // 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>',
                        ),*/
                ),
                /*
                'db'=>array(
                        'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
                ),
                // uncomment the following to use a MySQL database
                */


                'db'=>array(
                        'connectionString' => 'mysql:host=localhost;dbname=myDb',
                        'emulatePrepare' => true,
                        'username' => 'myDbUsername',
                        'password' => 'myDbPassword',
                        'charset' => 'utf8',
                        'tablePrefix'=>'',
                ),

                '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'=>'example@example.com',
        ),
        'import'=>array('application.modules.user.models.*',
        'application.models.*',
        'application.components.*',),
);

Yii引导不再预加载,因此现在必须使用路径别名。 这样做。下载yii引导程序的最新版本。 在main.php配置粘贴的第一行中:

Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
并按如下方式配置扩展:

'components'=>array(
        [...]
    'bootstrap' => array(
                //'class' => 'ext.bootstrap.components.Bootstrap'),
                'class'=>'bootstrap.components.Bootstrap'),
你就完了


有关更多参考资料,请阅读以下内容:

Yii引导不再预加载,因此现在必须使用路径别名。 这样做。下载yii引导程序的最新版本。 在main.php配置粘贴的第一行中:

Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
并按如下方式配置扩展:

'components'=>array(
        [...]
    'bootstrap' => array(
                //'class' => 'ext.bootstrap.components.Bootstrap'),
                'class'=>'bootstrap.components.Bootstrap'),
你就完了


有关更多参考资料,请阅读以下内容:

请确保为您解压缩的扩展/引导分配[read]访问权限

如果您在Mac/Linux上,请执行:

CHMOD755引导程序


在windows上,右键单击文件夹,并将读取权限分配给Apache的帐户。有时,将读取权限分配给“所有人”也是可以接受的(但这取决于您是否关心安全)。

请确保将[read]访问权限分配给您解压缩的扩展/引导

如果您在Mac/Linux上,请执行:

CHMOD755引导程序


在windows上,右键单击文件夹,并将读取权限分配给Apache的帐户。有时,将读取权限分配给“所有人”也是可以接受的(但这取决于您是否关心安全)。

我也遇到了同样的问题。我已授予扩展文件夹的完全(777)权限


试试看。

我也有同样的问题。我已授予扩展文件夹的完全(777)权限


试试看。

我在生产服务器上遇到了这个问题,尽管它在本地运行得很好

解决方案是将apache所有权授予yii安装:

sudo chown www-data:www-data -R /var/www/yourapp

以前的所有权是root,apache无法查看文件

我在生产服务器上遇到了这个问题,尽管它在本地运行良好

解决方案是将apache所有权授予yii安装:

sudo chown www-data:www-data -R /var/www/yourapp

以前的所有权是root,apache无法查看文件

是否将引导扩展复制到受保护的/extensions/bootstrap目录,并更改所有者和权限以使其可读?@Spidaboy7。。。粘贴配置时应该更加小心。在将密码和密钥发布到像这样的公共网站之前,请先隐藏它们。谢谢斯图和乌梅尔。我太绝望了,没有花时间发布。我希望不要再犯同样的错误@Stephen305,是的..我确实更改了bootstrap下所有文件的权限,扩展名也是可写/可读的!我就是想不出是怎么回事@Spidaboy7你能把
TbNavbar.php
的完整路径粘贴到bootstrap扩展文件夹中吗?是的,它的protected/extensions/bootstrap/widgets/TbNavbar.phpDid你能把bootstrap扩展复制到protected/extensions/bootstrap目录并更改所有者和权限,使其可读吗?@Spidaboy7。。。粘贴配置时应该更加小心。在将密码和密钥发布到像这样的公共网站之前,请先隐藏它们。谢谢斯图和乌梅尔。我太绝望了,没有花时间发布。我希望不要再犯同样的错误@Stephen305,是的..我确实更改了bootstrap下所有文件的权限,扩展名也是可写/可读的!我就是想不出是怎么回事@Spidaboy7你能把
TbNavbar.php
的完整路径粘贴到bootstrap扩展文件夹中吗?是的,它的protected/extensions/bootstrap/widgets/TbNavbar.php