How to output the value of a specific key name in a two-dimensional array
$url = ' http://quotes.money.163.com/hs/service/marketradar_ajax.php?page=0&query=STYPE%3AEQA&types= Jhjjfl&count=28&type=query ';
Match page number
$file =json_decode (file_get_contents ($url), true);
$out = $file [' list '];
$pageCount = (int) $file [' PageCount '];
Get the stock code for each page and put it in the appropriate array
for ($q =1; $q < $pageCount; $q + +) {
$url = ' http://quotes.money.163.com/hs/service/marketradar_ajax.php?page= '. $q. ' &query=stype%3aeqa&types= Jhjjfl&count=28&type=query ';
$file =json_decode (file_get_contents ($url), true);
foreach ($file [' list '] as $v) $out []= $v;
}
Var_export ($out);
How do I output a stock code with all the keys in the $out array named ' SYMBOL ' and put it in a new one-dimensional array
------Solution--------------------
PHP Code
$SYMBOLList = Array ();//container for ($q =1; $q < $pageCount; $q + +) { $url = ' http://quotes.money.163.com/hs/service/ Marketradar_ajax.php?page= '. $q. ' &query=stype%3aeqa&types=jhjjfl&count=28&type=query '; $file =json_decode (file_get_contents ($url), true); foreach ($file [' list '] as $v) { $out []= $v; echo $v [' SYMBOL ']; can be output directly $SYMBOLList [] = $v [' SYMBOL '];//after the array is saved} }
------Solution--------------------
function Get_symbol ($ar) {
return $ar [' SYMBOL '];
}