如何输出二维数组中特定键名的值
$url='http://quotes.money.163.com/hs/service/marketradar_ajax.php?page=0&query=STYPE%3AEQA&types=JHJJFL&count=28&type=query';
//匹配页码数
$file=json_decode(file_get_contents($url),true);
$out=$file['list'];
$pageCount=(int)$file['pagecount'];
//获取每一页的股票代码并放入相应的数组
for($q=1;$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);
请问如何输出$out数组中所有键名为'SYMBOL'后的股票代码,并将其放入一个新的一维数组中
------解决方案--------------------
$SYMBOLList = array();// 容器
for($q=1;$q<font color="#e78608">------解决方案--------------------</font><br>
function get_symbol($ar) {<br> return $ar['SYMBOL'];<br>}<br><br>$symbol = array_map('get_symbol', $out); <div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号