dpca31461 2015-06-19 05:44
浏览 45
已采纳

Isset不使用对象的内容

I have $list when I print it then I get following output

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
)

Now when I use

echo $list->unique_list_id;

then it shows me correct output. But when I try

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

} else {
        echo 'check 1';
}

then It always comes in else condition. Although unique_list_id is set in $list. I also tried with property_exists but it is also not working.

so my question is how to use isset with object data.

  • 写回答

2条回答 默认 最新

  • doupao6011 2015-06-19 06:19
    关注

    I see your unique_list_id is in data property. So you may check them with:

    if(isset($list->data['unique_list_id'])) {
        // do something
    } else {
        // do another one
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题