代码片段
7 行
            $num = 10;//几条数据
            $count = Db::name( 'topic' )->count();
            $rand = mt_rand( 0, $count-1 );
            $limit = $rand.','.$count;
            $list = Db::name( 'topic' )->limit( $limit )->select();
            shuffle( $list );
            $new_ary = array_slice( $list, 0, $num );
代码片段
1 行
            $new_ary = Db::name('topic')->orderRaw('rand()')->limit(10)->select();