【发布时间】:2011-01-20 20:16:12
【问题描述】:
我无法访问嵌套在我的 SOAP 对象结果中的特定元素。当我运行此代码时,Salesforce 工具包返回以下内容:
print_r ($response->records[0]->fields
返回
stdClass 对象(
[Number_of_Residents_c] => 1
[州_c] => 洛杉矶
[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 对象([类型] => 帐户 [字段] => stdClass Object ([Name] => Sample District Name) )
[2] => SObject 对象 ( [type] => 联系人
[字段] => 标准类对象([名称] => 保罗·史密斯 ) ) )
如果我想获得 Placement_Incentive_Description__c 的值,我可以使用:
print_r ($response->records[0]->fields->Placement_Incentive_Description__c
然而,困难在于如何访问 Account 对象中的 name 字段,该字段似乎是名为 [0] 的字段的子字段。我尝试了几种组合,但都没有运气。
【问题讨论】:
-
哥们,真的不可读,你能不能把它格式化一下?
-
我添加了一些换行符,让它看起来更愉快
标签: php arrays object soap salesforce