时间:2021-07-01 10:21:17 帮助过:25人阅读
分享到:
private function getUserInfo(callable $Human)
{
try {
$users = (new $Human)->getUser()['users'];
$underageUsers = [foreach ($users as $user) if ($user->age < 18) yield $user];
list($userNames, $ages) = array_map(
function($value) {return array_column($value, array('userNames', 'ages'), default);},
mb_convert_encoding($underageUsers, 'utf-8', 'gbk')
);
return ['name' => $userNames, 'surname' => $ages];
} catch(Exception $e) {
error_log($e);
}
}