其实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()函数