PHP头条
热点:

php稽查并创建多级目录


php检查并创建多级目录

//检查并创建多级目录
?? ?function checkDir($path){
?? ??? ?$pathArray = explode('/',$path);
?? ??? ?$nowPath = '';
?? ??? ?array_pop($pathArray);
?? ??? ?foreach ($pathArray as $key=>$value){
?? ??? ??? ?if ( ''==$value ){
?? ??? ??? ??? ?unset($pathArray[$key]);
?? ??? ??? ?}else{
?? ??? ??? ??? ?if ( $key == 0 )
?? ??? ??? ??? ??? ?$nowPath .= $value;
?? ??? ??? ??? ?else
?? ??? ??? ??? ??? ?$nowPath .= '/'.$value;
?? ??? ??? ??? ?if ( !is_dir($nowPath) ){
?? ??? ??? ??? ??? ?if ( !mkdir($nowPath, 0777) ) return false;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ??? ?return true;
?? ?}

www.phpzy.comtrue/phprm/1791.htmlTechArticlephp稽查并创建多级目录 php检查并创建多级目录 //检查并创建多级目录 ?? ?function checkDir($path){ ?? ??? ?$pathArray = explode('/',$path); ?? ??? ?$nowPath = ''; ?? ??? ?array_pop($pathArray); ?? ??? ?foreach ($pathA...

相关文章

相关频道:

PHP之友评论

今天推荐