以下是我来自 Salesforce 的以下返回查询。如果我尝试这样做,$form_information[0]->Program_Type__c;
我会收到以下错误:
不能将 stdClass 类型的对象用作数组
下面是我的以下数组,其中包含一个对象?。我的问题是如何从我的对象中提取 Program_type__c 和 Campus_ID__c 并将其保存到变量中?
print_r($form_information);
Array
(
[totalSize] => 1
[done] => 1
[records] => Array
(
[0] => stdClass Object
(
[attributes] => stdClass Object
(
[type] => Program_Instance__c
[url] => /services/data/v22.0/sobjects/Program_Instance__c/a0Ji0000001EUk9EAG
)
[Program_Type__c] => Field Science
[Program_Sub_type__c] =>
[Campus_ID__c] => a03i0000002DDBjAAO
)
)
)
var_dump
array(3) {
["totalSize"]=>
int(1)
["done"]=>
bool(true)
["records"]=>
array(1) {
[0]=>
object(stdClass)#21 (4) {
["attributes"]=>
object(stdClass)#22 (2) {
["type"]=>
string(19) "Program_Instance__c"
["url"]=>
string(68) "/services/data/v22.0/sobjects/Program_Instance__c/a0Ji0000001EUk9EAG"
}
["Program_Type__c"]=>
string(13) "Field Science"
["Program_Sub_type__c"]=>
NULL
["Campus_ID__c"]=>
string(18) "a03i0000002DDBjAAO"
}
}
}