0
API로 작업하고 있으며 쿼리를 실행할 때 var_dump
을 사용하여 반환 된 배열의 구조를 인쇄 할 수 있습니다. primaryAccountName
만 반환하려면 어떻게해야합니까? 이 브라우저에 반환되는 데이터가다차원 배열의 데이터에 액세스
// Configuration
$apiKey = 'xxxxxxxxxxxxxxxx';
$username = 'xxxxxxxxxxxxxxxx';
// End of configuration
require_once('NutshellApi.php');
$api = new NutshellApi($username, $apiKey);
// My search query
$result = $api->searchLeads(array('string' => "https://app01.nutshell.com/lead/49201", 'limit' => 1));
// var dump data is sampled below
var_dump($result);
: 여기
내 PHP 소스 코드 내가 코멘트에 제안을 시도array(1) {
[0]=> object(stdClass) #3 (14) {
["stub"] => bool(true)
["id"] => int(188681)
["rev"] => string(2) "29"
["entityType"] => string(5) "Leads"
["name"] => string(12) "Lead–49201"
["description"] => string(2) "RD"
["status"] => int(0)
["completion"] => int(61)
["value"] => object(stdClass) #4 (2) {
["currency"] => string(3) "USD"
["amount"]=> int(150000)
}
["primaryAccountName"] => string(11) "XYZ Industries"
["primaryContactName"] => string(11) "John Doe"
["isOverdue"] => bool(false)
["lastContactedDate"] => string(0) ""
["nextStepDueTime"] => string(24) "2014-10-29T15:52:40+0000"
}
}
, $result[0]["primaryAccountName"]
, 내가 가진 오류
Fatal error: Cannot use object of type stdClass as array in /home/location/location/location/file.php on line 12
'$의 VAR을 시도 할 수있다 [0] -> 부가가치> primaryAccountName', $ var'에 도시되어 var_dump''변수이다'. – Cheery
@dotnetom이 그것을 포맷하는 방법을 찾으면'$ var [0] -> primaryAccountName') – Cheery
@Cheery, 나는 앞을 내다가 PHP 소스를 포함한 내 게시물을 수정했습니다. 다시 한번 감사드립니다! –