PHP 二维数据去重

         $tj_recommend = [
            ['id' => 1, 'files_id' => 1],
            ['id' => 2, 'files_id' => 3],
            ['id' => 3, 'files_id' => 3],
            ['id' => 4, 'files_id' => 2],
            ['id' => 5, 'files_id' => 5],
            ['id' => 6, 'files_id' => 1],
            ['id' => 7, 'files_id' => 7],
            ['id' => 8, 'files_id' => 8],
            ['id' => 9, 'files_id' => 1]
        ];
        $arr = [];
        foreach($tj_recommend as $item){
            if(!in_array($item['files_id'], array_column($arr, 'files_id'))){
                $arr[] = $item;
            }
        }
        print_r($arr);exit;

34 thoughts on “PHP 二维数据去重”

  1. Great paintings! That is the type of info that are meant to be shared across the internet. Shame on the seek engines for no longer positioning this publish upper! Come on over and discuss with my site . Thanks =)

  2. Superb blog! Do you have any tips and hints for aspiring writers? I’m hoping to start my own site soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely overwhelmed .. Any recommendations? Thanks!

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Back To Top

鄂ICP备17008157号-1