看板 PHP 關於我們 聯絡資訊
$dr = opendir($path); while($file = readdir($dr)) { if ($file != "." && $file != ".." && $file != "test.txt") { copy("test.txt","123.txt"); } } 我是這樣寫, 當test.txt不存在此資料夾, 想要將123.txt複製一份存成test.txt, 問題是在於.. 假如我現在裡面已經有一個test.txt 但是跑了這段程式之後, 還是會用123.txt把它蓋掉.... 請問問題是在哪裡? 該怎麼改寫,跪求,感恩。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.214.162
cttlee:http://www.php.net/file_exists 04/13 23:46
aloha6131:帥啊 謝啦 04/14 00:19