【发布时间】:2017-09-28 15:34:52
【问题描述】:
我有一个函数,它返回一个结构如下的数组
[[{"title":"Mr","first_name":"James","last_name":"Loo","date_of_birth":36356,"email":"test@test.com","phone_number":1234567890,"company":"CompanyOne"},{"title":"Mr","first_name":"Jonah","last_name":"Lee","date_of_birth":42629,"email":"test@test2.com","phone_number":1234567890,"company":"CompanyTwo"}],
[]]
数组中有 2 个数组。第一个是“未插入条目”数组,第二个是“已插入条目”数组。
但是当我通过这个函数执行代码时
$result = $this->curl->execute();
$result_errors = array();
for($j=0;$j<sizeof($result);$j++){
$result_errors = $result[0];
}
if(sizeof($result_errors)>0){
echo json_encode($result_errors);
}
我在控制台中得到的结果只是“[”。
我错过了什么吗?我读过我必须回显和 json 编码数组,但它似乎没有出来。
【问题讨论】:
标签: javascript php arrays ajax codeigniter