PHP code example of ppeerit / think-user

1. Go to this page and download the library: Download ppeerit/think-user library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ppeerit / think-user example snippets


return [
	'user_session_name' => 'member_auth', // 用户session名称
	'user_session_sign' => 'member_auth_sign', // 用户session签名名称
	'user_pk' => 'uid', // 用户主键
	'password_key' => 'fg5h4ertH45df', // 密码加密字符串,自定义
	'encrypt_level' => 2, //加密等级,1:简单加密,2:双重加密
];

use Ppeerit\User\User;

// 登陆成功返回用户主键值,失败返回0
User::isLogin();

// auth参数为写入session的数组,必须包含用户主键
User::autoLogin($auth);

// pwd参数为需要加密的密码
User::encrypt($pwd);