🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
>功能 获取用户信息 >用法 getUserInfo($uid, $update = false, $field = ''); 或 getUserInfo($openid, $update = false, $field = ''); >参数 $uid 必须为 用户uid 或 $openid 必须为 用户openid $update 非必须 为空时读取缓存内用户信息,如需读取最新信息请设置为true $field 非必须 需要获取用户哪些字段信息,为空时获取用户全部信息 >返回值 返回包含用户信息的数组 ~~~ array (size=39) 'uid' => string '2' (length=1) //用户id 'nickname' => string '北北' (length=9) //用户昵称 'password' => null //密码 当为管理员时有 'truename' => null //真实姓名 'mobile' => null //手机号码 'email' => null //邮箱 'sex' => string '1' (length=1) //性别 0:保密 1:男 2:女 'headimgurl' => string //头像链接 'http://wx.qlogo.cn/mmopen/AhLk989Zrl06FmvQyLHwRTollf4IJzgU2O7zzBX3X9JMLheTE25zC6eXH5icJkOOsk4Xr963tiak0RxOkYicBdxow/0' (length=117) 'city' => string 'Xiangtan' (length=8) //所在城市 'province' => string 'Hunan' (length=5) //所在身份 'country' => string 'China' (length=5) //所在国家 'language' => string 'zh_CN' (length=5) //语言 'score' => string '100' (length=3) //积分 'experience' => string '100' (length=3) 'unionid' => string 'o11POw3MnY9lAJGZYJpbNs_XAMVU' (length=28) //用户unionid 统一开发者账户下的所有公众号中的同一用户unionid相同 'login_count' => string '0' (length=1) 'reg_ip' => null 'reg_time' => string '1451656809' (length=10) 'last_login_ip' => null 'last_login_time' => null 'status' => string '1' (length=1) 'is_init' => string '1' (length=1) 'is_audit' => string '1' (length=1) 'subscribe_time' => string '1451656809' (length=10) 'remark' => string '' (length=0) 'groupid' => string '0' (length=1) 'come_from' => string '0' (length=1) 'login_name' => null 'login_password' => null 'manager_id' => string '0' (length=1) 'level' => string '0' (length=1) 'membership' => string '0' (length=1) 'public_count' => null 'groups' => array (size=0) empty 'tokens' => array (size=1) 'wx1ff336758fc06f1d' => string 'ob8oYv3rrZuh-7ScINExlsrwJuhI' (length=28) 'remarks' => array (size=1) 'wx1ff336758fc06f1d' => null 'has_subscribe' => array (size=1) 'wx1ff336758fc06f1d' => string '1' (length=1) 'is_root' => boolean false 'sex_name' => string '男' (length=3) ~~~ >举例 ~~~ $uid = I ( 'uid' ); $userInfo = getUserInfo ( $uid ); dump($userInfo); ~~~