gpt4 book ai didi

php - Isset 不适用于对象的内容

转载 作者:行者123 更新时间:2023-12-03 04:17:40 26 4
gpt4 key购买 nike

当我打印它时,我有 $list 然后我得到以下输出

AWeberEntry Object
(
[_privateData:protected] => Array
(
[0] => resource_type_link
[1] => http_etag
)

[_localDiff:protected] => Array
(
)

[_collections:protected] => Array
(
)

[adapter] => OAuthApplication Object
(
[debug] =>
[userAgent] => AWeber OAuth Consumer Application 1.0 - https://labs.aweber.com/
[format] =>
[requiresTokenSecret] => 1
[signatureMethod] => HMAC-SHA1
[version] => 1.0
[curl] => CurlObject Object
(
)

[user] => OAuthUser Object
(
[authorizedToken] =>
[requestToken] =>
[verifier] =>
[tokenSecret] => BoPWmqWup6T1oAJAS0BJnKkN830iebnruCQ9I2FL
[accessToken] => AgJbZty67Z4w1uByP728Ybsr
)

[consumerKey] => AkaXl8e3tPa3urnbNI4YvBYQ
[consumerSecret] => kVGhArLuQT8iY4qMJ94dAk9nmWonKRuKHEBhpa2r
[app] => AWeberServiceProvider Object
(
[baseUri] => https://api.aweber.com/1.0
[accessTokenUrl] => https://auth.aweber.com/1.0/oauth/access_token
[authorizeUrl] => https://auth.aweber.com/1.0/oauth/authorize
[requestTokenUrl] => https://auth.aweber.com/1.0/oauth/request_token
)

)

[data] => Array
(
[total_unconfirmed_subscribers] => 0
[total_subscribers_subscribed_yesterday] => 0
[unique_list_id] => awlist3561167
[http_etag] => "0f9b24fd3d578a7fa402bda6cf029732c2ae9dba-ca5feee2b7fbb6febfca8af5541541ea960aaedb"
[web_form_split_tests_collection_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167/web_form_split_tests
[subscribers_collection_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167/subscribers
[total_subscribers_subscribed_today] => 0
[id] => 3561167
[total_subscribed_subscribers] => 519
[total_unsubscribed_subscribers] => 22
[campaigns_collection_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167/campaigns
[custom_fields_collection_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167/custom_fields
[self_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167
[total_subscribers] => 541
[resource_type_link] => https://api.aweber.com/1.0/#list
[web_forms_collection_link] => https://api.aweber.com/1.0/accounts/390249/lists/3561167/web_forms
[name] => 7affsubniche
)

[_dynamicData] => Array
(
)

[url] => /accounts/390249/lists/3561167
)

现在当我使用

echo $list->unique_list_id;

然后它显示了正确的输出。但当我尝试时

if(isset($list->unique_list_id)) {

} else {
echo 'check 1';
}

然后它总是以其他条件出现。虽然unique_list_id是在$list中设置的。我也尝试过使用 property_exists 但它也不起作用。

所以我的问题是如何将 isset 与对象数据一起使用。

最佳答案

我看到您的 unique_list_id 位于 data 属性中。所以你可以通过以下方式检查它们:

if(isset($list->data['unique_list_id'])) {
// do something
} else {
// do another one
}

关于php - Isset 不适用于对象的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30930719/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com