我无法访问嵌套在SOAP对象结果中的特定元素。运行此代码时,Salesforce工具包将返回以下内容:
print_r ($response->records[0]->fields
RETURNS
stdClass对象(
[Number_of_Residents_ c] => 1
[州 _c] => LA
[City _c] =>新奥尔良
[Placement_Incentive__c] =>是
[total_number_of_schools__c] => 125.0
[Total_Number_of_Students__c] => 24471.0
[Total_Number_of_Employees__c] => 1700.0
[Total_Operating_Revenue__c] => 1.2E8
[Governance_Model__c] =>市长/国家控制
[CEO_Superintendent_Appointment_Year__c] => 2007年[Trained_Leader__c] =>
[Final_Press_Clip_1_Title__c] =>夹 1个样品
[Final_Approved_Clip_1__c] => http://www.google.com
[Final_Press_Clip_2_Title__c] =>夹 2个样本
[Final_Approved_Clip_2__c] => http://www.yahoo.com
[Final_Press_Clip_3_Title__c] =>夹 3样本
[Final_Approved_Clip_3__c] => http://www.bing.com
[Final_Press_Clip_4_Title__c] =>
[Final_Approved_Clip_4__c] =>
[Final_Press_Clip_5_Title__c] =>
[Final_Approved_Clip_5__c] =>
[News_Clip_Status__c] =>完成
[New_Organization__c] =>是
[Student_Achievment_URL__c] => http://www.aol.com
[Work_Life__c] =>
[Placement_Incentive_Description__c] => $ 1000
[0] => SObject对象([type] => Account [fields] => stdClass对象([Name] =>样本区域名称))
[2] =>的sObject 对象([type] =>联系
[fields] => stdClass对象([名称] =>保罗史密斯)))
如果我想获得Placement_Incentive_Description__c的值,我可以使用:
的print_r ($响应 - >记录[0] - > fields-> Placement_Incentive_Description__c
然而,困难在于如何访问Account对象中的name字段,该对象似乎是名为[0]的字段的子节点。我尝试了几种组合但没有运气。
答案 0 :(得分:2)
哇,这很奇怪,尝试这样的事情。
$ attr = 0;
$响应 - >记录[0] - > fields-> {$ ATTR}