对 SQL 查询的结果 array_column 为空 [ 1.1 版本 ]
查询结果正常返回
array(8) {
[0]=>
object(SubjectTag)#119 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(1) "8"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "公益行动"
["sort"]=>
string(1) "4"
["status"]=>
string(1) "1"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316235"
["updated_at"]=>
string(10) "1541556833"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(1) "8"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[1]=>
object(SubjectTag)#120 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(1) "9"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "公益报名"
["sort"]=>
string(1) "3"
["status"]=>
string(1) "1"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316251"
["updated_at"]=>
string(10) "1541556829"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(1) "9"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[2]=>
object(SubjectTag)#121 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "10"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "公益组织"
["sort"]=>
string(1) "2"
["status"]=>
string(1) "1"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316260"
["updated_at"]=>
string(10) "1532401686"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "10"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[3]=>
object(SubjectTag)#122 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "16"
["sid"]=>
string(1) "3"
["name"]=>
string(15) "十佳志愿者"
["sort"]=>
string(1) "1"
["status"]=>
string(1) "1"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1541556615"
["updated_at"]=>
string(10) "1541556818"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "16"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[4]=>
object(SubjectTag)#123 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "11"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "儿童服务"
["sort"]=>
string(1) "4"
["status"]=>
string(1) "0"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316278"
["updated_at"]=>
string(1) "0"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "11"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[5]=>
object(SubjectTag)#124 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "12"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "敬老服务"
["sort"]=>
string(1) "3"
["status"]=>
string(1) "0"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316288"
["updated_at"]=>
string(10) "1532316705"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "12"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[6]=>
object(SubjectTag)#125 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "13"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "应急救援"
["sort"]=>
string(1) "2"
["status"]=>
string(1) "0"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316296"
["updated_at"]=>
string(10) "1532316702"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "13"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
[7]=>
object(SubjectTag)#126 (11) {
["_new":"CActiveRecord":private]=>
bool(false)
["_attributes":"CActiveRecord":private]=>
array(9) {
["id"]=>
string(2) "14"
["sid"]=>
string(1) "3"
["name"]=>
string(12) "流浪动物"
["sort"]=>
string(1) "1"
["status"]=>
string(1) "0"
["rel_sid"]=>
string(1) "0"
["tag_type"]=>
string(1) "0"
["created_at"]=>
string(10) "1532316305"
["updated_at"]=>
string(10) "1532316762"
}
["_related":"CActiveRecord":private]=>
array(0) {
}
["_c":"CActiveRecord":private]=>
NULL
["_pk":"CActiveRecord":private]=>
string(2) "14"
["_alias":"CActiveRecord":private]=>
string(1) "t"
["_errors":"CModel":private]=>
array(0) {
}
["_validators":"CModel":private]=>
NULL
["_scenario":"CModel":private]=>
string(6) "update"
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
}
$status = array_column($result, 'status');
使用 array_column
取 status
未能正确返回,结果为空数组
array(0) {
}
有大佬能指教下吗,感谢!
最佳答案
其他 1 个回答
Simine 江苏省
注册时间:2019-04-18
最后登录:2020-03-14
在线时长:13小时44分
最后登录:2020-03-14
在线时长:13小时44分
- 粉丝0
- 金钱995
- 威望0
- 积分1125