duanchan9354
2015-06-03 14:43
浏览 49
已采纳

使用PHP从json数据中获取内容

I have a question. How to get content only from json data.

My JSON Data:

array(
(int) 0 => '{"html":"Lorem Ipsum \u2013 Lorem Ipsum \u2013 Lorem Ipsum - Lorem Ipsum \u2013 Lorem Ipsum \u2013 Lorem Ipsum \u2013 Lorem Ipsum"}',
(int) 1 => '{"text":"Lorem Ipsum"}',
(int) 2 => '{"text":"01 June-30 September"}',
(int) 3 => '{"text":"7 nights \/ 8 days"}',
(int) 4 => '{"text":"Lorem Ipsum"}'
);


I want to get html and text content only

Lorem Ipsum
Lorem Ipsum
01 June-30 September

I tried to use json_decode.

My Code:

foreach($array as $i) {
        $a = json_decode($i);
        echo $a;
}

Anyone help me please?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题