分享

编程语言PHP删除文件夹内及其文件

 冒险的K 2021-10-18
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./faq/233293.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多