php文件rmdir删除操作时,出现Permission denied,解决方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php文件rmdir删除操作时,出现Permission denied,解决方法相关的知识,希望对你有一定的参考价值。
Say, you‘re working on Windows and continue to get a permission‘s error without a reason. Then it may be that a different Windows program is working on the folder (see earlier notes also). In the case that you can‘t find that program, the line<?php closedir(opendir($dirname)); ?>
may solve the problem!
Make sure to write this before rmdir($dirname);.
这个是查看PHP手册的 这个是我的代码
function delAllDir($dir) { $dh = opendir($dir); closedir(opendir($dir)); while ( false !== ( $file = readdir ( $dh))) { if($file != ‘.‘ && $file != ‘..‘) { $fullpath = $dir.‘/‘.$file; if(is_dir($fullpath)) { delAllDir($fullpath); }else { unlink($fullpath); } @rmdir($fullpath); } } return true; }
以上是关于php文件rmdir删除操作时,出现Permission denied,解决方法的主要内容,如果未能解决你的问题,请参考以下文章