我正在从 flickrs API 获取一些 JSON。我的问题是 exif 数据的顺序因相机而异。所以我不能硬编码一个数组编号来获取例如下面的相机型号。PHP 是否有任何内置方法来搜索关联数组值并返回匹配的数组?在下面的示例中,我想搜索[label] => Model
and get [_content] => NIKON D5100
。
如果您想让我详细说明,请告诉我。
print_r($exif['photo']['exif']);
结果:
Array
(
[0] => Array
(
[tagspace] => IFD0
[tagspaceid] => 0
[tag] => Make
[label] => Make
[raw] => Array
(
[_content] => NIKON CORPORATION
)
)
[1] => Array
(
[tagspace] => IFD0
[tagspaceid] => 0
[tag] => Model
[label] => Model
[raw] => Array
(
[_content] => NIKON D5100
)
)
[2] => Array
(
[tagspace] => IFD0
[tagspaceid] => 0
[tag] => XResolution
[label] => X-Resolution
[raw] => Array
(
[_content] => 240
)
[clean] => Array
(
[_content] => 240 dpi
)
)