作者aloha6131 (夏威夷草群舞风)
看板PHP
标题[请益] 判断资料夹内有没有存在某个档案?
时间Fri Apr 13 23:18:23 2007
$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
2F:推 aloha6131:帅啊 谢啦 04/14 00:19