cakephp数组groupby多列

时间:2019-02-13 04:24:30

标签: php arrays cakephp cakephp-3.0

我正在使用CakePHP 3.6。我有这个数组,我想按季节和类似$ data [“ season”] [“ episode”]的情节对数组进行分组。 考虑到$ data的索引约为1000,我该如何实现?

我了解Hash::combine() ; 但据我了解,这只是一个级别。 谢谢

 $data =   [
        [
            "episode" => "01" ,
            "season"  => "01" ,
            "name"    => "first" ,
            "...."    => "......." ,
        ] ,
        [
            "episode" => "01" ,
            "season"  => "01" ,
            "name"    => "second" ,
            "...."    => "......." ,
        ] ,
        [
            "episode" => "03" ,
            "season"  => "01" ,
            "name"    => "third" ,
            "...."    => "......." ,
        ] ,
        [
            "episode" => "01" ,
            "season"  => "02" ,
            "name"    => "......." ,
            "...."    => "......." ,
        ] ,
    ];

0 个答案:

没有答案