Home  >  Article  >  Backend Development  >  PHP怎么进行文件备份

PHP怎么进行文件备份

WBOY
WBOYOriginal
2016-06-13 10:20:211093browse

PHP如何进行文件备份
我现在有个文件路径是d:/file/XXX.RAR,我想把XXX.RAR备份到d:/file1/XXX.RAR,
XXX.RAR的文件名加上时间戳。。
我只需要执行PHP脚本就备份一次。就可以了

------解决方案--------------------

PHP code
<?php $file = 'd:\\file\\XXX.RAR';$newfile = 'd:\\file1\\XXX.RAR';if (!copy($file, $newfile)) {    echo "failed to copy $file...\n";}?><div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn