Heim > Artikel > Backend-Entwicklung > 大家帮忙看一下这段简单的代码哪里有有关问题
大家帮忙看一下这段简单的代码哪里有问题
<br /> private function getUserInfo(callable $Human)<br /> {<br /> try {<br /> $users = (new $Human)->getUser()['users'];<br /> $underageUsers = [foreach ($users as $user) if ($user->age < 18) yield $user];<br /> <br /> list($userNames, $ages) = array_map(<br /> function($value) {return array_column($value, array('userNames', 'ages'), default);}, <br /> mb_convert_encoding($underageUsers, 'utf-8', 'gbk')<br /> );<br /> <br /> return ['name' => $userNames, 'surname' => $ages];<br /> } catch(Exception $e) {<br /> error_log($e);<br /> }<br /> }<br />