我想獲取照片文件ID。json解碼通話照片電報api
file_get_contents('php://input'):
{
"update_id": 399206890,
"message": {
"message_id": 149,
"from": {
"id": 81777999,
"is_bot": false,
"first_name": "@goldenguardbot",
"last_name": "✅",
"username": "amirntm",
"language_code": "en-US"
},
"chat": {
"id": 81777999,
"first_name": "@goldenguardbot",
"last_name": "✅",
"username": "amirntm",
"type": "private"
},
"date": 1507643430,
"photo": [
{
"file_id": "AgADBAADpaoxG6lZ6VIeePTlKxaJsl3X-RkABPbjyThHJgF7FLwBAAEC",
"file_size": 1639,
"file_path": "photos/file_4.jpg",
"width": 90,
"height": 72
},
{
"file_id": "AgADBAADpaoxG6lZ6VIeePTlKxaJsl3X-RkABIrarvPZGVNGFrwBAAEC",
"file_size": 22230,
"width": 320,
"height": 256
},
{
"file_id": "AgADBAADpaoxG6lZ6VIeePTlKxaJsl3X-RkABKFhu79tL5EBF7wBAAEC",
"file_size": 95422,
"width": 800,
"height": 640
},
{
"file_id": "AgADBAADpaoxG6lZ6VIeePTlKxaJsl3X-RkABGzlLqe_Yv0PFbwBAAEC",
"file_size": 172689,
"width": 1160,
"height": 928
}
]
}
}
我想要文件ID如何得到它?例如: :
$update->message->photo->file_id;
'$最新情況:> MESSAGE->相片[0] - > file_id' – WillardSolutions
[json_decode()](http://php.net/manual/en/function。 json-decode.php) – RiggsFolly
如果你不理解json字符串表示法,那麼總是通過執行'$ t = json_decode($ your_json_string);的print_r($噸);' – RiggsFolly