json 电报机器人解码
json decode for telegram bot
我有这个文件 json
通过在电报机器人中询问 php 中的照片个人资料图片而收到,我只想保存一些关于它的信息。
这是代码:
{
"ok": true,
"result": {
"total_count": 16,
"photos": [
[
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
}
],
[
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
}
],
...
我只需要保存 file_id
,但我不知道该怎么做。
不一定全部file_id,就一次!
对不起,我的英语不好..
有人可以帮助我吗?
$x = json_decode($yourJSON, true);
$id = $x["result"]["photos"][0][0]["file_id"]
我有这个文件 json
通过在电报机器人中询问 php 中的照片个人资料图片而收到,我只想保存一些关于它的信息。
这是代码:
{
"ok": true,
"result": {
"total_count": 16,
"photos": [
[
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
}
],
[
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
},
{
"file_id": "2342423423252",
"file_size": 13038,
"width": 160,
"height": 160
}
],
...
我只需要保存 file_id
,但我不知道该怎么做。
不一定全部file_id,就一次! 对不起,我的英语不好.. 有人可以帮助我吗?
$x = json_decode($yourJSON, true);
$id = $x["result"]["photos"][0][0]["file_id"]