上代码

 


/**
 * 递归删除文件夹下的所有文件
 *
 * @param [type] $strDirPath
 * @return void
 * @author 一颗大萝北 [email protected]
 */
function dgRmDir($strDirPath)
{
    $arrDirList = scandir($strDirPath);
    unset($arrDirList[0]);
    unset($arrDirList[1]);
    $arrDirList = array_values($arrDirList);
    foreach ($arrDirList as $k => $item) {
        if (is_file($strDirPath . “\\” . $item)) {
            unlink($strDirPath . “\\” . $item);
        } else {
            dgRmDir($strDirPath . “\\” . $item);
        }
    }
    rmdir($strDirPath);
}
说点什么
支持Markdown语法
好耶,沙发还空着ヾ(≧▽≦*)o
Loading...