Yiistrap.Alias bootstrap.helpers.TbHtml中的CException“;无效


CException in Yiistrap .Alias bootstrap.helpers.TbHtml" is invalid

在我的web应用程序中,我需要实现yiistrap。但我遇到了这个错误,无法纠正。别名"bootstrap.helpers.TbHtml"无效。确保它指向现有的目录或文件。我的配置/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(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'My Web Application',
'aliases' => array(
        'bootstrap' => realpath(__DIR__ . '/protected/config/extensions/bootstrap'), // change this if necessary
    ),
    // 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(
            'class'=>'system.gii.GiiModule',
            'password'=>'xxxx',
            // 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(
        'user'=>array(
            // enable cookie-based authentication
            'allowAutoLogin'=>true,
        ),
        // uncomment the following to enable URLs in path-format
            'urlManager'=>array(
                'urlFormat'=>'path',
                 'showScriptName' => false,
                 'rules'=>array(
                       '/'=>'/view',
                            '//'=>'/',
                         '/'=>'/',
                             ),             
                                ),

        /*
        'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),
                 */
        // uncomment the following to use a MySQL database
        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=electrical',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => 'xxxxx',
            'charset' => 'utf8',
        ),
        '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',
                ),
                */
            ),
        ),
'bootstrap' => array(
            'class' => 'bootstrap.components.TbApi',   
        ),
    ),

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

任何人都可以帮我做这件事。我无法继续。

首先在/config/main.php中定义它,并使bootstrap别名

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

TbHtml不是一个标准的引导程序小部件,也许你需要从其他地方获得它,并将它放在目录/extensions/bootstrap/helpers/TbHtml中,也许它是YiiStraps助手

之一