Get the App
SLTechnology News&Howtos  ›  Development  › 

How PHP loops to delete directories

Shulou Source: shulou.com Published: 2022-06-01 02:34:15 09月21日 Update

Editor to share with you how PHP cycle to delete the directory, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Delete directory in a loop

Function cleanup_directory ($dir) {foreach (new DirectoryIterator ($dir) as $file) {if ($file- > isDir ()) {if (! $file- > isDot ()) {cleanup_directory ($file- > getPathname ());} else {unlink ($file- > getPathname ());}} rmdir ($dir);} above is all the content of the article "how PHP circularly deletes directories". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Contents loops articles content not much most more knowledge industry information information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information Xiaomi Huawei Shulou Technology