Remove empty subfolders with PHP

后端 未结 6 1372
小鲜肉
小鲜肉 2020-12-09 22:38

I am working on a PHP function that will recursively remove all sub-folders that contain no files starting from a given absolute path.

Here is the code developed so

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 22:54

    This line

    $ret = $ret ? $ret : $res;
    

    Could be made a little more readable:

    $ret = $ret || $res;
    

    Or if PHP has the bitwise operator:

    $ret |= $res;
    

提交回复
热议问题