【问题标题】:how to prnt json data printed from get_file_contents php function如何从get_file_contents php函数打印json数据打印
【发布时间】:2020-05-23 00:03:36
【问题描述】:

我从 get_file_contents 输出中打印了这个 json。

{"status":"INVALID_CREDENTIALS"}

现在我想回显“状态”的内容,我使用了

echo $status

但不工作。请帮忙。

【问题讨论】:

    标签: php arrays json curl echo


    【解决方案1】:

    首先,使用json_decode转换为php对象:

     $json = '{"status":"INVALID_CREDENTIALS"}';
     $obj = json_decode($json);
    

    然后:

     echo $obj->status;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-02
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      相关资源
      最近更新 更多