php多表查询数据合并,避免foreach循环嵌套

$memberList = $member->getMemberList();
$members = [];
if (is_array($memberList)) {
foreach ($memberList as $item) {
$members[$item["id"]] = $item["nickname"];
}
} foreach ($result as $item) {
$item["member_name"] = array_key_exists($item["member_id"], $members) ? $members[$item["member_id"]] : "";
$list[] = $item;
}
上一篇:跑 vue 项目


下一篇:360春秋杯CTF比赛WRIteUP