PHP的从多维数组中删除空数组

目前,我在尝试从csv文件中删除空数组时陷入困境,并且迷失了方向,实际上却不了解如何提取空数组。我从csv文件中提取了5个随机行,但该文件可以正常工作,但在混洗后我只能得到1个空白数组。

我的输出:

.slider__container {
    &.--media {
        .slider {
            .slide {
                img,video {
                    max-height: calc(100% - (30px * 4) - (28px * 2));
                    max-width: calc(100% - 60px);
                    @at-root #{selector-append('body.home',&)} {
                        max-height: calc(100% - (65px * 4) - (28px * 2));
                        transition: transform 400ms,filter 400ms;
                        transform: scale(0.8);
                    }
                    @include media(tablet-p) {
                        max-height: calc(100% - (20px * 4) - (28px * 2));
                        max-width: calc(100% - 40px);
                        @at-root #{selector-append('body.home',&)} {
                            max-width: calc(100% - 100px);
                        }
                    }
                    @include media(phone) {
                        max-height: calc(100% - (20px * 4) - (28px * 2));
                        max-width: calc(100% - 40px);
                        @at-root #{selector-append('body.home',&)} {
                            max-height: calc(100% - (65px * 4) - (24px * 2));
                            max-width: calc(100% - 50px);
                            transform: scale(0.7);
                        }
                    }
                }
            }
        }
    }
}

环顾四周后,我认为array_map和array_filter可以工作,但可以清除整个数组

var cardDeck = [{
'image':'','year':'','hint':'','caption':''
},{
'image':'<img class="card_image" src="https://www.floridamemory.com/onlineclassroom/game/cards/1586.png">','year':'1586','hint':'Sir Francis Drake attacks Saint Augustine','caption':'On May 28 and 29,1586,Sir Francis Drake led an attack on the Spanish city of St. Augustine. The Englishman commanded a fleet of 25 ships commissioned by Queen Elizabeth to conduct a series of raids against Spanish settlements in the Americas. <a href="https://www.floridamemory.com/blog/2012/05/29/francis-drake-attacks-st-augustine/" target="_blank">Read More</a>'
},{
'image':'<img class="card_image" src="https://www.floridamemory.com/onlineclassroom/game/cards/1926.png">','year':'1926','hint':'Great Miami Hurricane','caption':'A catastrophic hurricane made landfall near Miami Beach in the early morning hours of September 18,1926. Known as the "Great Miami Hurricane," the storm cut a path of destruction across Southern Florida. <a href="https://www.floridamemory.com/exhibits/floridahighlights/hurricane/" target="_blank">Read More</a>'
},{
'image':'<img class="card_image" src="https://www.floridamemory.com/onlineclassroom/game/cards/1969.png">','year':'1969','hint':'First humans on the Moon','caption':'On July 20,1969,Commander Neil Armstrong and Lunar Module Pilot edwin "Buzz" Aldrin,Jr. landed in the Sea of Tranquility and became the first humans to walk on the moon <a href="https://www.floridamemory.com/onlineclassroom/nasa/photos/" target="_blank">Read More</a>'
},{
'image':'<img class="card_image" src="https://www.floridamemory.com/onlineclassroom/game/cards/1822.png">','year':'1822','hint':'Territory of Florida Established','caption':'This first act of Florida\'s Territorial Legislature in 1822 divided the territory into four counties and established local courts. <a href="https://www.floridamemory.com/exhibits/floridahighlights/s222/" target="_blank">Read More</a>'
}
];

我的代码:

$r= array_map('array_filter',$r);
$r= array_filter( $r);
xw20090630 回答:PHP的从多维数组中删除空数组

决定不再使用PHP数组,只是使用js数组来调用它

本文链接:https://www.f2er.com/3135198.html

大家都在问