我有一个多维数组($array),其中的条目看起来像:
{ ["upload/example.gif"]=> array(5) {
["title"]=> string(12) "This is me"
["excerpt"]=> string(24) "This is a photo of a tree"
["img"]=> string(42) "upload/example.gif"
["link"]=> string(23) "http://www.google.co.uk"
["source"]=> string(6) "custom"
}
}
我需要能够根据键名从$array
中删除任何重复的值。如果我的数组是:
$array = array( ["upload/example.gif"] => etc....
["upload/tree.gif"] => etc....
["upload/example.gif"] => etc....)
我可以删除其中一个["upload/example.gif"] => etc....
数组。
我尝试过:
$array = array_map('unserialize', array_unique(array_map('serialize', $array)));
但是那并没有起作用。
提前感谢。