海豚php源码,基于 ThinkPHP5.1 实现的海豚后台登录源码分析

基于 thinkphp5.1 实现的海豚后台登录源码分析

一、 首先来到登录代码处,部分代码截图,大家有兴趣可以自己去看源码

登录处开始

public function signin()

{

if ($this->request->isPost()) {

// 获取post数据

$data = $this->request->post();

$rememberme = isset($data['remember-me']) ? true : false;

// 登录钩子, 做一些登录前动作, 这里暂时没有实现

$hook_result = Hook::listen('signin', $data);

if (!empty($hook_result) && true !== $hook_result[0]) {

$this->error($hook_result[0]);

}

// 验证数据

$result = $this->validate($data, 'User.signin');

if(true !== $result){

// 验证失败 输出错误信息

$this->error($result);

}

// 验证码

if (config('captcha_signin')) {

$captcha = $this->request->post('captcha', '');

$captcha == '' && $this->error('请输入验证码');

if(!captcha_check($captcha, '')){

//验证失败

$this->error('验证码错误或失效');

};

}

// 登录

$UserModel = new UserModel模型分析; // 进去模型逻辑

$uid = $UserModel->login($data['username'], $data['password'], $rememberme);

if ($uid) {

// 记录行为

action_log('user_signin', 'admin_user', $uid, $uid);

$this->jumpUrl();

} else {

<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值