野生大熊猫

discuz 通过uid快捷查询username
$a = DB::fetch_all("SELECT * FROM ".DB::table('...
扫描右侧二维码阅读全文
23
2018/04

discuz 通过uid快捷查询username

$a = DB::fetch_all("SELECT * FROM ".DB::table('common_credit_log')." $w1 ORDER BY logid DESC LIMIT $start,$perpage");
foreach ($a as $key => $value) {$uids[] = $value['uid'];}//获取用户名
$usernames = C::t('common_member')->fetch_all_username_by_uid($uids);

下面是我查询积分表的时候使用到的,因为要考虑不能在循环中查询数据库,所以这样先查询出来。
使用的是fetch_all_username_by_uid这个函数即可,$uids为数组。return的数据为'uid'=>'username'

Last modification:July 16th, 2018 at 01:49 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment