|
本帖最后由 君山 于 2020-9-7 20:37 编辑
根据uid 获取用户基本数据
- /**
- * 根据uid 获取用户基本数据
- * @staticvar array $users 存放已经获取的用户的信息,避免重复查库
- * @param <int> $uid
- * @return <array>
- */
- function getuserbyuid($uid, $fetch_archive = 0) {
- static $users = array();
- if(empty($users[$uid])) {
- $users[$uid] = C::t('common_member'.($fetch_archive === 2 ? '_archive' : ''))->fetch($uid);
- if($fetch_archive === 1 && empty($users[$uid])) {
- $users[$uid] = C::t('common_member_archive')->fetch($uid);
- }
- }
- if(!isset($users[$uid]['self']) && $uid == getglobal('uid') && getglobal('uid')) {
- $users[$uid]['self'] = 1;
- }
- return $users[$uid];
- }
复制代码 |
|