简体   繁体   English

从json提取链接

[英]Extract link from json

4 days ago Iam asking for how to Extract the data from content of HTML 4天前Iam询问如何从HTML内容中提取数据

It is work and everything good but the problem is print all data, look like json: 这是工作,一切都很好,但是问题是打印所有数据,看起来像json:

{"post_id":"453298879","author_id":"1348","media_type":1,"images_src":"http:\/\/i.imgur.com\/JpfhVqK.png","content":"Hello World!"}

Just want content of images_src . 只需要images_src的内容。 http://i.imgur.com/JpfhVqK.png

I'm trying to use json_decode but doesn't work. 我正在尝试使用json_decode,但不起作用。

Ps: there are no file of json, just variable content this json. ps:没有json文件,只是此json的变量内容。

Any idea? 任何想法?

var data =
   {"post_id":"453298879","author_id":"1348","media_type":1,"images_src":"http:\/\/i.imgur.com\/JpfhVqK.png","content":"Hello
    World!"};

console.log(data.images_src) console.log(data.images_src)

data.image_src will output : 'http://i.imgur.com/JpfhVqK.png'

It works: 有用:

$json = '{"post_id":"453298879","author_id":"1348","media_type":1,"images_src":"http:\/\/i.imgur.com\/JpfhVqK.png","content":"Hello World!"}';
$data = json_decode($json, true);
var_dump($data['images_src']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM