账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    如何印 json_decode 第二層?
    48
    0

    這是我 json_decode 對方回給我的 json 結果

    stdClass Object
    (
        [attributes] => Array
            (
                [0] => stdClass Object
                    (
                        [attribute-id] => 5c6186217d4d0765152e42f7
                        [attribute-type] => skill
                        [parent-attribute-id] => 
                        [parent-attribute-name] => 
                        [name] => rgargrereshserhersh
                        [slogan] => srehsrehrsehsrehre
                        [description] => hrehrehresserhgserhserh
                        [time-created] => 2019-02-11T14:54:57.073Z
                        [available] => 1
                        [time-available] => 2019-02-11T14:26:41.348Z
                        [image-path] => http://127.0.0.1:9002/images/attribute/icon/15498952015c61862103aea-icon.JPG
                        [cover-path] => http://127.0.0.1:9002/images/attribute/cover/15498952015c61862103aea-cover.jpg
                    )
    
            )
    
    )

    請問我要怎麼印出 name?
    他第一層有 「attributes」
    我原本的做法是

    <?=$data->{'name'};?>

    但是不行⋯⋯多了第一層的「attributes」讓我沒辦法印,如何印第二層的KEY?
    PS:只會有一筆,所以不會用 foreach

    2
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 逍遥云飞 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部