直接上才艺,在php>5.5中,目前来看没有用过小于5.5版本了
源数据,截一部分
array (size=10)
0 =>
array (size=6)
'Field' => string 'ID' (length=2)
'Type' => string 'bigint(20) unsigned' (length=19)
'Null' => string 'NO' (length=2)
'Key' => string 'PRI' (length=3)
'Default' => null
'Extra' => string 'auto_increment' (length=14)
1 =>
array (size=6)
'Field' => string 'user_login' (length=10)
'Type' => string 'varchar(60)' (length=11)
'Null' => string 'NO' (length=2)
'Key' => string 'MUL' (length=3)
'Default' => string '' (length=0)
'Extra' => string '' (length=0)
2 =>
array (size=6)
'Field' => string 'user_pass' (length=9)
'Type' => string 'varchar(255)' (length=12)
'Null' => string 'NO' (length=2)
'Key' => string '' (length=0)
'Default' => string '' (length=0)
'Extra' => string '' (length=0)
我们想要获取其中的Filed字段变成一维数据
$arr2 = array_column($desc, 'Field');
看结果打印:
array (size=10)
0 => string 'ID' (length=2)
1 => string 'user_login' (length=10)
2 => string 'user_pass' (length=9)
3 => string 'user_nicename' (length=13)
4 => string 'user_email' (length=10)
5 => string 'user_url' (length=8)
6 => string 'user_registered' (length=15)
7 => string 'user_activation_key' (length=19)
8 => string 'user_status' (length=11)
9 => string 'display_name' (length=12)
这样还是极给力的
暂无评论
要发表评论,您必须先 登录