Fetch the repository succeeded.
您可以用本代码配合 mzphp 快速实现用户系统。
请将 mzphp 框架代码放至与本项目同级。
user类直接在control类中使用自动加载的方式:
class index_control extends auth_contorl{
public function on_index(){
// 登录uid为1的用户
$this->user->login(1);
// 获得当前登录用户的user_id
$uid = $this->user->user_id;
// 获得当前登录用户的所有字段
$user = $this->user->field();
// 获得当前登录用户的 logcount 字段
$login_count = $this->user->field('logcount');
// 获得用户uid=9 的用户 phone 字段
$phone = $this->user->field('phone');
// 退出登录
$this->user->logout();
// 注册流程
// 生成盐
$salt = $this->user->get_salt();
// 生成密码
$pass = $this->user->get_pass('admin888', $salt);
// 注册用户
$uid = $this->user->register('admin', '18888888888', $pass, $salt, 1);
}
}
具体请参考源码 core/user.class.php
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。