我從hxxp JSON數組://best1st.info/Moviedb/json.php米= tt2015381 & O = JSON如何顯示具有特定值/字符的數組元素?
這裏是陣列輸出的樣品:
. and so on
.
.
[STORYLINE] => On planet Earth in 1988, young Peter Quill () sits in the waiting room of a hospital...
[ALSO_KNOWN_AS] => Array
(
[0] => Guardianes de la galaxia = Argentina
[1] => Qalaktikanin Mühafizeçileri = Azerbaijan
[2] => Пазителите на Ð「алактиката = Bulgaria (Bulgarian title)
[3] => Guardiões da Galáxia = Brazil
)
[RELEASE_DATES] => Array
(
.
.
. and so on
我想檢查是否在「ALSO_KNOWN_AS」元素中,有「阿根廷」字樣,如果「ALSO_KNOWN_AS」元素有「阿根廷」字樣,則顯示它(值)。
我已經嘗試做(搜索與谷歌和這裏的計算器),但似乎我的代碼不工作,這裏有一個人可以幫我解決這個問題,這裏是我的代碼
$url = 'http://best1st.info/Moviedb/json.php?m=tt2015381&o=json';
$newdata = json_decode(file_get_contents($url));
$alsoKnownAs = $newdata->ALSO_KNOWN_AS;
if (in_array('Argentina', $alsoKnownAs)) {
echo "Match found";
// echo the-array-value
}
else
{
echo "Match not found";
return false;
}
謝謝您
這是我的工作,感謝你SKRocks – esi0411 2014-09-01 05:44:09