Home >Backend Development >PHP Tutorial >在yii2中怎么配置前后台,使得在一个项目中同时可以登陆前后台

在yii2中怎么配置前后台,使得在一个项目中同时可以登陆前后台

WBOY
WBOYOriginal
2016-06-06 20:35:531278browse

在yii2中怎么配置前后台,使得在一个项目中同时可以登陆前后台.
我现在在config/web.php配置是这有配置前台的:
'user' => [
'identityClass' => 'app\models\FrontUser',
'enableAutoLogin' => true,
'loginUrl'=>['manager/login'],//定义后台默认登录界面[权限不足跳到该页]
//'identityCookie' => ['name' => '__user_identity', 'httpOnly' => true],
'idParam' => '__user'
],

接下来我想怎么配置可以登陆后台,求大神指教。

回复内容:

在yii2中怎么配置前后台,使得在一个项目中同时可以登陆前后台.
我现在在config/web.php配置是这有配置前台的:
'user' => [
'identityClass' => 'app\models\FrontUser',
'enableAutoLogin' => true,
'loginUrl'=>['manager/login'],//定义后台默认登录界面[权限不足跳到该页]
//'identityCookie' => ['name' => '__user_identity', 'httpOnly' => true],
'idParam' => '__user'
],

接下来我想怎么配置可以登陆后台,求大神指教。

前台

<code>'user' => [
    'identityClass' => 'app\models\FrontUser',
    'enableAutoLogin' => true,
    'loginUrl'=>['manager/login'],//定义后台默认登录界面[权限不足跳到该页]
    //'identityCookie' => ['name' => '__user_identity', 'httpOnly' => true],
    'idParam' => '__user'
],
</code>

后台

<code>'admin' => [
    'class' => 'yii\web\User',
    'identityClass' => 'app\models\AdminUser',
    'enableAutoLogin' => true,
    'loginUrl'=>['manager/login'],//定义后台默认登录界面[权限不足跳到该页]
    //'identityCookie' => ['name' => '__user_identity', 'httpOnly' => true],
    'idParam' => '__admin'
],
</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn