使用array_map简单搞定PHP删除文件、删除目录,
废话不多说,直接贴上代码。本文体现的就是简洁
复制代码 代码如下:
//删除目录下所有空目录
array_map('rmdir', glob('*', GLOB_ONLYDIR));
//删除目录所有文件
array_map('unlink', array_filter(glob('*'), 'is_file'));
使用array_map实现array_column功能:
复制代码 代码如下:
$data = array(
array(
'a' => 'first a',
'b' => 'first b'
),
array(
'a' => 'second a',
'b' => 'second b'
)
);
$array_column = array_map(function($element){
return $element['a'];
}, $data);
print_r($array_column);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!
