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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:35:53
Original
1292 people have browsed it

在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>
Copy after login

后台

<code>'admin' => [
    'class' => 'yii\web\User',
    'identityClass' => 'app\models\AdminUser',
    'enableAutoLogin' => true,
    'loginUrl'=>['manager/login'],//定义后台默认登录界面[权限不足跳到该页]
    //'identityCookie' => ['name' => '__user_identity', 'httpOnly' => true],
    'idParam' => '__admin'
],
</code>
Copy after login
Related labels:
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template