标签:
$matching_tickets = ‘‘;
foreach ($list as $kk => $vv) {
$type = substr($vv[‘train_code‘], ‘0‘, ‘1‘);
if ($train_type == $type) {
$matching_tickets[] = $vv; //挑出匹配的车次 余票
}
}
if(!$matching_tickets){ //如果没有匹配的车票..这个变量不存在.使用判断会报错..定义一个默认值比较可靠
$matching_tickets = $tickets[‘result‘][‘list‘];
}
标签:
原文地址:http://www.cnblogs.com/bj-tony/p/5550665.html