您的位置:首页 > 编程语言 > PHP开发

php拷贝文件或者是文件夹

2009-03-27 10:12 309 查看
其实php做文件拷贝是很简单,看下我写的源码你就知道了

function filecopy($oldfile,$newfile){
$old_file = fopen($oldfile,"rb");
$new_file = fopen($newfile,"wb");
if($old_file){
while($str = fread($old_file,50)){
try{
fwrite($new_file,$str);
}catch(Exception $e){
echo $e->getMessage();
}
}
fflush($new_file);
fclose($new_file);
fclose($old_file);
}

很简单的几行代码就搞定了,而且没有使用copy()函数
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: