简体   繁体   English

我有一个 JSON object,如何在 PHP 中打印?

[英]I Have a JSON object, how to print it in PHP?

i wanna ask how to print a JSON object in php, i save the JSON in a variabel called $btc_price我想问如何在 php 中打印 JSON object,我将 $0ECD11C1D7A287401DZpricectA2 中的 Z0ECD11C1D7A287401DZpricectA2

The JSON look like this: JSON 看起来像这样:

{ "bitcoin": { "idr": 682724276 } } { “比特币”:{ “idr”:682724276 } }

JSON image JSON 图像

You can use json_decode() function to decode the json variable into an associative array and output the result to the screen.您可以使用json_decode() function 将 json 变量解码为关联数组,并将结果 output 解码到屏幕上。 For example:例如:

$btc = json_decode($btn_price);
echo $btc["bitcoin"]["idr"];

Refer here:参考这里:

json_decode() php manual json_decode() php 手册

json_decode() w3schools json_decode() w3schools

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

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