yii2怎么使用user组件
时间:2020-03-19 18:14
yii2怎么使用user组件 1、首先安装yii2 user组件 2、然后进行配置 3、注意事项 (相关教程推荐:yii框架) 同时删除本来的user配置 此外要注意自己写的控制器,model,数据库这些都不能有user 最后执行$ php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations 这样就安装完毕。 4. 使用yii2-user 下面是对应功能的url,其余使用和yii2自带的user差不多的 例如: PHP中文网,大量thinkphp教程,欢迎学习! 以上就是yii2怎么使用user组件的详细内容,更多请关注gxlsystem.com其它相关文章!composer require "dektrium/yii2-user:0.9.*@dev"
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
'confirmWithin' => 21600,
'cost' => 12,
'admins' => ['admin']
],
],
/user/registration/register Displays registration form
/user/registration/resend Displays resend form
/user/registration/confirm Confirms a user (requires id and token query params)
/user/security/login Displays login form
/user/security/logout Logs the user out (available only via POST method)
/user/recovery/request Displays recovery request form
/user/recovery/reset Displays password reset form (requires id and token query params)
/user/settings/profile Displays profile settings form
/user/settings/account Displays account settings form (email, username, password)
/user/settings/networks Displays social network accounts settings page
/user/profile/show Displays user's profile (requires id query param)
/user/admin/index Displays user management interface
<div class="login-strip">
<?php
if(Yii::$app->user->isGuest){
?>
<?= Html::a("<i class='icon-plus'></i> 注 册",['/user/registration/register']); ?> |
<?= Html::a("<i class='icon-signin'></i> 登 录",['/user/security/login']); ?>
<?php
} else {
?>
<?= Html::a("<i class='icon-signout'></i> 退出",['/user/security/logout']); ?>
<?php
}
?>
</div>