yii用户扩展提供了无效的别名错误

yii用户扩展提供了无效的别名错误,yii,yii-extensions,Yii,Yii Extensions,我是yii的新手,下载了这个扩展 我已将所有必要的文件上载到受保护的文件夹中 但我一直在犯这个错误。我错过了什么 Alias "user.UserModule" is invalid. Make sure it points to an existing PHP file and the file is readable. /Applications/XAMPP/xamppfiles/htdocs/dev2/framework/YiiBase.php(322) 我编辑了我的config/

我是yii的新手,下载了这个扩展

我已将所有必要的文件上载到受保护的文件夹中

但我一直在犯这个错误。我错过了什么

 Alias "user.UserModule" is invalid. Make sure it points to an existing PHP file and the file is readable.

/Applications/XAMPP/xamppfiles/htdocs/dev2/framework/YiiBase.php(322)
我编辑了我的config/main/php,现在看起来像这样

<?php

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

// Define a path alias for the Bootstrap extension as it's used internally.
// In this example we assume that you unzipped the extension under protected/extensions.
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'my site',
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory

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

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

    'modules'=>array(
        // uncomment the following to enable the Gii tool

        'gii'=>array(
            'class' => 'system.gii.GiiModule',
            'password' => 'gii', //Enter Your Password Here
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters' => array('127.0.0.1','::1'),
            'generatorPaths' => array('bootstrap.gii'),
        ),
        'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',

            # send activation email
            'sendActivationMail' => true,

            # allow access for non-activated users
            'loginNotActiv' => false,

            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,

            # automatically login from registration
            'autoLogin' => true,

            # registration path
            'registrationUrl' => array('/user/registration'),

            # recovery password path
            'recoveryUrl' => array('/user/recovery'),

            # login form path
            'loginUrl' => array('/user/login'),

            # page after login
            'returnUrl' => array('/user/profile'),

            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),

    ),

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

        'bootstrap' => array(
            'class' => 'bootstrap.components.Bootstrap',
        ),
        // 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=DBNAME',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'tbl_',
        ),

        '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'=>'admin@******.com',
    ),
);

如果您使用的是linux环境,则可能是您的文件没有足够的预存空间来运行用户模块目录下的文件

试试这个,看看问题是否出在这里

chmod-R 777/受保护/模块/用户/


不确定您正在使用哪个版本的yii用户,但请先下载,并遵循该页面的设置更改

确保将所有文件解压到受保护的/modules/user(注意:modules和user文件夹不存在,因此您必须创建一个)

完成后,将项目插入zii.widgets.CMenu数组(protected/views/layouts/main.php


我不知道为什么,但在加载YiBooster 4.0.1版本的最后一个版本后,我也遇到了同样的问题。我的问题通过在我的应用程序的所有部分用“booster”更改所有“bootstrap”别名来解决

举例来说

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

另外,不要忘记在所有操作中使用筛选方法:

 public function filters(){
    return [
        'accessControl',
        'postOnly + delete',
        ['booster.filters.BoosterFilter - delete'],
    ];
}

你是说
chmod-R 777/protected/models/user/
?是的,它已经是777了,但仍然不起作用。你应该把用户解包到模块下,而不是模型下!
'bootstrap' => array(
        'class' => 'ext.yiibooster.components.Bootstrap',
    ),
 'booster' => [
        'class' => 'ext.yiibooster.components.Booster',
    ],
 public function filters(){
    return [
        'accessControl',
        'postOnly + delete',
        ['booster.filters.BoosterFilter - delete'],
    ];
}