找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 php教程 查看内容

php稽查并创建多级目录

作者:模板之家 2020-10-31 15:18 223人关注

php检查并创建多级目录//检查并创建多级目录???functioncheckDir($path){??????$pathArray=explode('/',$path);??????$nowPath='';??????arra,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;
?? ?}


路过

雷人

握手

鲜花

鸡蛋
原作者: 互联网 来自: 网络收集

全部回复(0)