为什么array_column警告我它在此代码段中收到null?它似乎对$ hLA里面收到的内容感到愤怒,但它显然是一个二维阵列。我收到的错误是:“PHP警告:array_column()期望参数1为数组,给定为”
来自var_dump $ hLA的值:
$hL = pg_query("SELECT * FROM hubs");
$hLA = pg_fetch_all($hL);
function updateArticles($tP){
global $hLA;
$hmkey = array_search($tP['hm'], array_column($hLA, 'hm'));
}
array(4) {
[0]=>
array(6) {
["hm"]=>string(12) "5CCF7F33B58C"
["hx"]=>string(1) "9"
["hy"]=>string(2) "14"
["zn"]=>string(6) "T1"
["r"]=>string(1) "n"
["a"]=>string(1) "n"
}
[1]=>
array(6) {
["hm"]=>string(12) "5CCF7FACBBFD"
["hx"]=>string(1) "1"
["hy"]=>string(1) "1"
["zn"]=>string(4) "R"
["r"]=>string(1) "y"
["a"]=>string(1) "n"
}
[2]=>
array(6) {
["hm"]=>string(12) "5CCF7FADCE84"
["hx"]=>string(1) "8"
["hy"]=>string(1) "5"
["zn"]=>string(4) "Exit"
["r"]=>string(1) "n"
["a"]=>string(1) "y"
}
}