<?php //////当前查询出来的数据 $redata = array( 0=>['id'=>1,'name'=>'张三','age'=>22,'hobby'=>'学习'], 1=>['id'=>1,'name'=>'张三','age'=>22,'hobby'=>'骑行'], 2=>['id'=>2,'name'=>'李四','age'=>20,'hobby'=>'旅游'], ); //怎么样才能转换成下面这种形式的? 写了一上午 愣是没写出来 $arr = array( 0=>[ 'id'=>1,'name'=>'张三','age'=>22,'hobby'=> ['学习', '骑行'] ], 1=>[ 'id'=>2,'name'=>'李四','age'=>20,'hobby'=> ['旅游'] ] );