Php 如何访问对象数组,如代码所示

Php 如何访问对象数组,如代码所示,php,Php,如何访问每个文件名 {"Appointments": [ { "file_name":"eeea4a560492004c5c14f9414e88c32c.jpg", "file_type":"image\/jpeg", "file_path":"C:\/inetpub\/wwwroot\/nautSearch\/server\/uploadedfiles\/files\/",

如何访问每个文件名

 {"Appointments":
    [
        {
            "file_name":"eeea4a560492004c5c14f9414e88c32c.jpg", 
            "file_type":"image\/jpeg", 
            "file_path":"C:\/inetpub\/wwwroot\/nautSearch\/server\/uploadedfiles\/files\/", 
            "orig_name":"a46cf6866df6f358bece629ef472ac69.jpg", 
            "file_ext":".jpg", 
            "file_size":418.17, 
            "is_image":true, 
            "image_width":2560, 
            "image_height":1440, 
            "image_type":"jpeg", 
            "image_size_str":"width=\"2560\" height=\"1440\""

        }, 
        {
            "file_name":"c08ff85a44e0f86ab48ec709e6ba1b4a.jpg", 
            "file_type":"image\/jpeg", 
            "file_path":"C:\/inetpub\/wwwroot\/nautSearch\/server\/uploadedfiles\/files\/", 
            "file_ext":".jpg", 
            "file_size":27.38, 
            "is_image":true, 
            "image_width":479, 
            "image_height":403, 
            "image_type":"jpeg", 
            "image_size_str":"width=\"479\" height=\"403\""

        }, 
        {
            "file_name":"4536acd0479c6c5dee3b1f546ed8d328.jpg", 
            "file_type":"image\/jpeg", 
            "file_path":"C:\/inetpub\/wwwroot\/nautSearch\/server\/uploadedfiles\/files\/", 
            "file_ext":".jpg", 
            "file_size":27.38, 
            "is_image":true,
            "image_width":479, 
            "image_height":403, 
            "image_type":"jpeg", 
            "image_size_str":"width=\"479\" height=\"403\""

        }
    ]
}

您给出的是一个json字符串。首先,您必须对其进行解码并循环访问约会以使用文件名:

$result = json_decode($yourJsonString);

foreach ($result->Appointments as $appointment) {
    echo $appointment->file_name;
}

欢迎来到SO!请详细说明一下这个数据结构是什么。你是从档案里读的吗?网络服务?它是否已解析为对象或数组?你试了什么?所谓访问,是指检索文件名还是读取文件?thanx..它可以工作