模擬xcopy的函數(shù)
更新時間:2006年10月09日 00:00:00 作者:
模擬xcopy的函數(shù) <?php
/*************************************
* 系統(tǒng)名稱:模擬xcopy的函數(shù)
* 程序功能:模擬xcopy的函數(shù)
* 開發(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ù)說明:
// $source:源目錄名
// $destination:目的目錄名
// $child:復制時,是不是包含的子目錄
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ù)使用說明
函數(shù)array_map()函數(shù):多數(shù)組回調(diào)函數(shù)---將回調(diào)函數(shù)作用到給定數(shù)組的單元上2011-07-07PHP函數(shù)之日期時間函數(shù)date()使用詳解
date()函數(shù)是我們在php開發(fā)中常碰到并且會使用到的一個日期函數(shù),下面我來給大家介紹date()函數(shù)的一些基本扮靚和方法,有需要了解的朋友可進入?yún)⒖?/div> 2013-09-09用PHP調(diào)用數(shù)據(jù)庫的存貯過程!
用PHP調(diào)用數(shù)據(jù)庫的存貯過程!...2006-10-10最新評論