我正在使用 amazon api 检索要存储在数据库中的演员列表。我不断收到重复的条目,并希望有人能在可能的情况下帮助我。
这是我正在做的
$i = $result->Items->Item->ItemAttributes->Actor;
echo "Actor :"; $alist = array(); foreach ($i as $a) { $alist[] = $a; print_r($alist); }
他就是结果。
Array ( [0] => SimpleXMLElement Object ( [0] => Tommy Lee Jones ) ) Array ( [0] => SimpleXMLElement Object ( [0] => Tommy Lee Jones ) [1] => SimpleXMLElement Object ( [0] => John Goodman ) ) Array ( [0] => SimpleXMLElement Object ( [0] => Tommy Lee Jones ) [1] => SimpleXMLElement Object ( [0] => John Goodman ) [2] => SimpleXMLElement Object ( [0] => Peter Sarsgaard ) ) Array ( [0] => SimpleXMLElement Object ( [0] => Tommy Lee Jones ) [1] => SimpleXMLElement Object ( [0] => John Goodman ) [2] => SimpleXMLElement Object ( [0] => Peter Sarsgaard ) [3] => SimpleXMLElement Object ( [0] => Kelly Macdonald ) ) Array ( [0] => SimpleXMLElement Object ( [0] => Tommy Lee Jones ) [1] => SimpleXMLElement Object ( [0] => John Goodman ) [2] => SimpleXMLElement Object ( [0] => Peter Sarsgaard ) [3] => SimpleXMLElement Object ( [0] => Kelly Macdonald ) [4] => SimpleXMLElement Object ( [0] => Mary Steenburgen ) )
任何帮助,将不胜感激。
干杯