巨大な配列 (7000 以上の項目) の結果を見つけようとしていますが、何らかの理由で、以前に別のプロジェクトで使用したスクリプトが false を返すか、何かを忘れている可能性があります。
配列を並べ替えて、変数にリストされている 2 つの項目を見つけようとしています。コードは次のとおりです。
$.getJSON('proxy.php?url=http://api.bukget.org/api/plugins', function(data){
var list = ['essentials', 'worldguard'];
//console.log(data);
$.each(data, function(i, plugin){
if (plugin === list) {
console.log('found!');
} else {
return false;
}
});
});
私のコードには何が欠けていますか?
プロキシの使用:
<?php
if (!isset($_GET['url'])) die();
$url = urldecode($_GET['url']);
$url = 'http://' . str_replace('http://', '', $url); // Avoid accessing the file system
echo file_get_contents($url);
?>
データを作成するもの(スニペット):
["a5h73y", "ab-marriage", "abacus", "abag", "abandonedcarts", "abilitytrader", "abitofrealism", "aboot", "absorbchests", "acc", "acceptdarules", "acceptrules", "accesscontrol", "accessories", "accident-tnt", "accountlock", "achat", "achievement", "achievements", "acientcave", "acommands", "actionzones", "activator", "activityhistory", "activitypromotion", "activitytracker"]