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()函数
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()函数
相关文章推荐
- PHP文件夹文件拷贝/复制函数 dir_copy($src = '', $dst = '')
- PHP移动文件或者文件夹
- PHP文件夹文件拷贝/复制函数 dir_copy($src = '', $dst = '')
- php--------文件夹文件拷贝和复制
- 两个虚拟机互相拷贝文件或者文件夹
- java借助org.apache的fileUtils实现文件或者文件夹的拷贝
- php-本机服务器移动文件或者递归移动文件夹
- [ubuntu]如何跨机器拷贝文件或者文件夹
- Android 拷贝Asset目录下文件或者文件夹
- php--------文件夹文件拷贝和复制
- PHP文件夹文件拷贝/复制函数 dir_copy($src = '', $dst = '')
- PHP移动文件或者文件夹
- php移动文件或者递归移动文件夹
- PHP访问文件或者文件夹或者文件夹相关函数。
- 在 Qt 的 .pro 中定义拷贝文件或者文件夹
- php--------文件夹文件拷贝和复制
- PHP访问文件或者文件夹或者文件夹相关函数。
- 利用shell脚本或者php移动某个文件夹下的文件到各自的日期组成的目录下
- SSH登陆 scp拷贝文件及文件夹
- PHP 判断远程或者本地文件是否存在