Home Article php 二维数组按照指定字段排序

php 二维数组按照指定字段排序

Source:php 二维数组按照指定字段排序 Release time:2019-08-24 Author:Mr.赵 Reading volume:59
$list=DB::name('agent_slide')->where('agentid='.session::get('agent'))->order('slideid asc')->select();
foreach ($list as $key =>$value){
$slide=DB::name('slideshow')->where('id='.$value['slideid'])->find();
$list[$key]['title']=$slide['title'];
$list[$key]['amount']=$slide['amount'];
$list[$key]['claim']=$slide['claim'];
$list[$key]['imgs']=$slide['imgs'];
$list[$key]['list_order']=$slide['list_order'];
}
$flag = array();
foreach($list as $v){
$flag[] = $v['list_order'];
}
array_multisort($flag, SORT_ASC, $list);
$this->assign('list',$list);
取数组中最后三条且倒序排序
$arrs=array_slice($newest,-3,3,false);;

$flag = array();
foreach($arrs as $k =>$v){
$flag[] = $v['nums'];
}
array_multisort($flag, SORT_DESC , $arrs);



  
I want to comment
Leave a message
http://boke.zhaozhiqi.top/index.php/
User login
You have not written any reviews yet!
You have commented!
Can only praise once!
You have a collection!