从array / json获取前置值

时间:2015-06-23 10:43:11

标签: php arrays json

我希望得到我的图像值,例如images / thispicture.png。

我有一个带有一些值的数组或Json,但问题是我只想要数组中的图像。

这是我现在从阵列中得到的:

{"image_intro":"images\/16748007940_1cc8f06622_small.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}"><img src="/{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}"><img src="/{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}

我只想要&#34; image_intro&#34;我怎么能这样做?

当我json_decode我得到这个输出:

["image_intro"]=>
  string(39) "images/16748007940_1cc8f06622_small.jpg"
  ["float_intro"]=>
  string(0) ""
  ["image_intro_alt"]=>
  string(0) ""
  ["image_intro_caption"]=>
  string(0) ""
  ["image_fulltext"]=>
  string(0) ""
  ["float_fulltext"]=>
  string(0) ""
  ["image_fulltext_alt"]=>
  string(0) ""
  ["image_fulltext_caption"]=>
  string(0) ""

怎么办?我怎么能把它变成一个我能反映的字符串?

提前致谢!

2 个答案:

答案 0 :(得分:1)

您可以使用$array["image_intro"],这会为您提供image_intro的值。查看manual

答案 1 :(得分:0)

尝试关注

$array["image_intro"]