且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用php将json数据传输到html?

更新时间:2022-05-24 22:13:41

您首先需要获取文件.您应该为此使用curl.在下面的示例中,我使用了file_get_contents()函数,您可能需要替换它.使用json_decode()为您解析JSON.

You first need to get the file. You should use curl for this. In the example below I used the file_get_contents() function, you might want to replace it. Use json_decode() to parse the JSON for you.

$json = file_get_contents($url);
$data = json_decode($json);
echo $data->results[0]->body;

这将回显A guide to cultural....