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

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

WBOY
Release: 2016-06-07 17:23:43
Original
1215 people have browsed it

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


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


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

   函数代码:

Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template