Heim  >  Artikel  >  Backend-Entwicklung  >  php使用copy()拷备文件的一个有关问题

php使用copy()拷备文件的一个有关问题

WBOY
WBOYOriginal
2016-06-13 12:25:57796Durchsuche

php使用copy()拷备文件的一个问题
请问各位大师,我在使用php的copy()拷备文件
$file  =  'd:/temp/example.txt' ;
$newfile  =  'e:/example.txt' ;

if (! copy ( $file ,  $newfile )) {
    echo  "failed to copy  $file ...\n" ;
}
?> 
拷备后的文件的时间为完成拷备的时间,而我希望拷备后的文件时间与原文件一样,不知如何处理。
请大师们指点。
------解决思路----------------------

touch($newfile, filectime($file));

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn