2

我正在使用 Salesforce.com Toolkit for PHP,我正在尝试输出一些我认为非常简单的东西。

这是工作示例代码

$query = "SELECT ID, Phone FROM Contact LIMIT 5";
$response = $mySforceConnection->query($query);

foreach ($response->records as $record) {
echo $record->ID." - ".$record->Phone;
}

我已经调整了查询​​,现在只想输出名称和计数。但是下面的代码不起作用

$query = "SELECT owner.name, count(type) FROM Task LIMIT 5";
$response = $mySforceConnection->query($query);

foreach ($response->records as $record) {
echo $record->owner.name; //DOES NOT WORK
}

这就是我print_r ($record); 时得到的

stdClass Object ( [Id] => [any] => Array ( [0] => First Last [1] => 2177 ) ) 

我只想能够输出“First Last - 2177”

4

1 回答 1

3
foreach ($response->records as $record)
{
    echo implode(' - ', $record->any);
}
于 2011-05-01T04:11:23.983 回答