使用 Harvest php API http://mdbitz.com/harvest-api/examples/和我的 Harvest php 数组打印以下数据:
$myresult = $harvestAPI->getUser($client_id);
$data = $myresult->get( "data" );
print_r($data);
数据:
Harvest_User Object ( [_root:protected]
=> user [_convert:protected]
=> 1 [_values:protected]
=> Array ( [id]
=> 999 [email]
=> user@example.com [created-at]
=> 2014-06-12T20:00:00Z [is-admin]
=> false [first-name]
=> John [last-name]
=> Smith [timezone]
=> Mountain Time (US & Canada) [is-contractor]
=> false [telephone]
=> [is-active]
=> true [has-access-to-all-future-projects]
=> false [default-hourly-rate]
=> 200.0 [department]
=> Development [dev]
=> false [updated-at]
=> 2015-06-15T18:00:00Z [cost-rate]
=> 100.0 ) )
但是当使用 json 类将其转换为 json 时,它给了我空的 {} 任何想法发生了什么?
$dataJSON = json_encode($data);
print_r($dataJSON);