-2

我有一个在 print_r 上输出它的对象:

Dropbox\Client Object
(
    [accessToken:Dropbox\Client:private] => secret
    [clientIdentifier:Dropbox\Client:private] => examples-web-file-browser
    [userLocale:Dropbox\Client:private] => 
    [apiHost:Dropbox\Client:private] => api.dropbox.com
    [contentHost:Dropbox\Client:private] => api-content.dropbox.com
    [root:Dropbox\Client:private] => 
    [host] => Dropbox\Host Object
        (
            [api:Dropbox\Host:private] => api.dropbox.com
            [content:Dropbox\Host:private] => api-content.dropbox.com
            [web:Dropbox\Host:private] => www.dropbox.com
        )

)

我如何获得“秘密”的价值?

更新: var_dump($dbxClient);

输出:

object(Dropbox\Client)#3 (7) {
  ["accessToken":"Dropbox\Client":private]=>
  string(64) "HrouVh2oRTcAAAAAAAAAARYOdXzK5tA9lCscE24fdnVnt5wYYPSSaK8nITv4PFtc"
  ["clientIdentifier":"Dropbox\Client":private]=>
  string(25) "examples-web-file-browser"
  ["userLocale":"Dropbox\Client":private]=>
  NULL
  ["apiHost":"Dropbox\Client":private]=>
  string(15) "api.dropbox.com"
  ["contentHost":"Dropbox\Client":private]=>
  string(23) "api-content.dropbox.com"
  ["root":"Dropbox\Client":private]=>
  NULL
  ["host"]=>
  object(Dropbox\Host)#2 (3) {
    ["api":"Dropbox\Host":private]=>
    string(15) "api.dropbox.com"
    ["content":"Dropbox\Host":private]=>
    string(23) "api-content.dropbox.com"
    ["web":"Dropbox\Host":private]=>
    string(15) "www.dropbox.com"
  }
}
4

1 回答 1

4

在Dropbox的官方 PHP SDKlib/Dropbox/Client.php在线类文件中,有一个方法会返回属性的值。18getAccessToken()accessToken

因此,在您的情况下,这应该可以完成工作:

var_dump($dbxClient->getAccessToken());

以后在发布此类问题之前,请先查看 SDK 和 API 的文件。

于 2013-11-13T08:49:53.957 回答