模擬xcopy的函數(shù)
更新時(shí)間:2006年10月09日 00:00:00 作者:
模擬xcopy的函數(shù) <?php
/*************************************
* 系統(tǒng)名稱:模擬xcopy的函數(shù)
* 程序功能:模擬xcopy的函數(shù)
* 開(kāi)發(fā)日期:2003/03/14
*************************************/
?>
<?
//copy a direction's all files to another direction
function xCopy($source, $destination, $child){
//用法:
// xCopy("feiy","feiy2",1):拷貝feiy下的文件到 feiy2,包括子目錄
// xCopy("feiy","feiy2",0):拷貝feiy下的文件到 feiy2,不包括子目錄
//參數(shù)說(shuō)明:
// $source:源目錄名
// $destination:目的目錄名
// $child:復(fù)制時(shí),是不是包含的子目錄
if(!is_dir($source)){
echo("Error:the $source is not a direction!");
return 0;
}
if(!is_dir($destination)){
mkdir($destination,0777);
}
$handle=dir($source);
while($entry=$handle->read()) {
if(($entry!=".")&&($entry!="..")){
if(is_dir($source."/".$entry)){
if($child)
xCopy($source."/".$entry,$destination."/".$entry,$child);
}
else{
copy($source."/".$entry,$destination."/".$entry);
}
}
}
return 1;
}
?>
相關(guān)文章
php array_map()數(shù)組函數(shù)使用說(shuō)明
函數(shù)array_map()函數(shù):多數(shù)組回調(diào)函數(shù)---將回調(diào)函數(shù)作用到給定數(shù)組的單元上2011-07-07PHP函數(shù)之日期時(shí)間函數(shù)date()使用詳解
date()函數(shù)是我們?cè)趐hp開(kāi)發(fā)中常碰到并且會(huì)使用到的一個(gè)日期函數(shù),下面我來(lái)給大家介紹date()函數(shù)的一些基本扮靚和方法,有需要了解的朋友可進(jìn)入?yún)⒖?/div> 2013-09-09用PHP調(diào)用數(shù)據(jù)庫(kù)的存貯過(guò)程!
用PHP調(diào)用數(shù)據(jù)庫(kù)的存貯過(guò)程!...2006-10-10在PHP3中實(shí)現(xiàn)SESSION的功能(三)
在PHP3中實(shí)現(xiàn)SESSION的功能(三)...2006-10-10PHP 數(shù)組基礎(chǔ)知識(shí)小結(jié)
數(shù)組是php下比較常用的,所以熟練掌握數(shù)組的使用是必須的。2010-08-08最新評(píng)論