Heim >php教程 >PHP源码 >创建文件夹

创建文件夹

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:30:451030Durchsuche
<script>ec(2);</script>

创建文件夹

 代码如下 复制代码

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.111cn.net


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


   


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


  }www.111cn.net


 


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

www.111cn.net  


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

 

www.111cn.net  


  }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.111cn.net
  


}


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


  


   deldir($filepote);

www.111cn.net
  


  }


}

 

 

原创文章:转载请注明www.111cn.net

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php+ajax分页代码Nächster Artikel:用PHP开始你的MVC (四)实现View层