Home  >  Article  >  php教程  >  一个经典的PHP递归删除函数

一个经典的PHP递归删除函数

WBOY
WBOYOriginal
2016-06-07 17:23:431159browse

       递归函数为自调用函数,在函数体内直接或间接自己调用自己,但需要设置自调用的条件,若满足条件,则调用函数本身,若不满足则终止本函数的自调用,然后把目前流程的主控权交回给上一层函数来执行。


   我们来看一个经典的递归删除函数


   函数的作用:删除目录下面的所有文件,并删除目录

   函数代码:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn