天天看点

对象转换为数组 json_decode()

对象格式为:字符串包着对象

string(256) "{"error":"duplicate_unique_property_exists","timestamp":1605924398610}"
           

用json_decode()函数来转换格式:

$data = json_decode($all,true);//要加上true才可以
           

得到的数据为:

array(5) {
  ["error"] => string(32) "duplicate_unique_property_exists"
  ["timestamp"] => int(1605924398610)
}