当前位置:编程学习 > php >>

创建文件夹

创建文件夹

function Createfolder($path,$nname){
 if(is_dir($path) && is_writable($path)){

 if(preg_match("/^\w{1,255}$/i",$nname)){
   echo mkdir($path."/".$nname,0777)?'Create Folder success':'Create Folder Fail';
  }else{
   echo "Folder Error";
  }

 }else{
  echo "Can't Create Error file not is_writable or not dir"; }

}

粘贴文件

function Past($currentpath,$currentfilename,$filepote){ //1:文件要被粘贴到的位置2:当前文件{夹}名3:文件{夹}所在的物理地址  


 


  $str = substr($currentfilename,-1,1);


  


  if(substr($currentfilename,-1,1)=="|"){


   www.226511.com


   $currentfilename = str_replace("|","",$currentfilename);


   


   $filepote   = str_replace("|","",$filepote);


  }www.226511.com


 


  if(is_dir($currentpath) && is_writable($currentpath) && is_dir($filepote) && is_writable($filepote)){

www.226511.com  


   //@mkdir($currentpath."/".$currentfilename);
   $t=full_copy($filepote,$currentpath."/".$currentfilename)?'t':'f';//$filepote,need copy folder $current sava folder

 

www.226511.com  


  }else if(is_file($filepote) && file_exists($filepote)){   


   if(file_exists($currentpath.$currentfilename)){ echo ('file exists! plase rename it!');exit;}


   


    echo copy($filepote,$currentpath.$currentfilename)?'success':'errror';  

www.226511.com
  


}


  if( $str =="|" && $t='t' ){ 


  


   deldir($filepote);

www.226511.com
  


  }


}

 

 

原创文章:转载请注明www.226511.com

补充:Php教程,Php常用代码
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,