编程语言PHP删除文件夹内及其文件
function Delete($path){
if (is_dir($path) === true)
{
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file)
{
Delete(realpath($path) . '/' . $file);
}
return rmdir($path);
}
else if (is_file($path) === true)
{
return unlink($path);
}
return false;
}
语法:
<?php
$path = "images/";
Delete($path); // This will delete images folder along with its contents.
?>
文章来源:https://www.php.cn/faq/233293.html
百度网盘搜索 |
www.bdsoba.com |
搜白度 |
www.sobd.cc |
教程弟 |
www.jcdi.cn |
搜码吧 |
www.somanba.cn |