Array
(
[0] => Array
(
[user_id] => 1
)
[1] => Array
(
[user_id] => 22
)
)
I only want 1 and 22. How to change it into $a=array('1','22');
滿天的星座2017-05-16 13:15:51
php版本要大于5.5.0
$userid_array = array_column($x,'userid');
php版本要大于5.4.0
$userid_array = array_map(function($item){return $item['userid'];},$x);
再低就for循环吧
伊谢尔伦2017-05-16 13:15:51
Do you need to query by column? Such a query can directly find the data of a one-digit array
$use_id = Db->table('table')->where([])->column('user_id');