我写这个简单的代码来保存图像文件:避免重写已经存在
// $randomimage contains a random image url.
$content = file_get_contents($randomimage);
file_put_contents('images/'.$randomimage, $content);
我需要一种方法来没有使用相同的名字重写的图像。所以,如果具有某个名称的图像已经存在于我的/ images /文件夹中,那么请不要做任何事情。 这很简单,但我不知道该怎么做。
我有信心在某些时候你会开始学习如何自己搜索这些东西,而不是询问[每个](http://stackoverflow.com/questions/10389890/what-field-type - 到 - 商店的Facebook标记)[单](http://stackoverflow.com/questions/10389560/what-is-the-best-field-to-store-the-birthday)[小](http :/ /问题](http://stackoverflow.com/questions/10281742/how-to-know-if-a - 某些资源并存)。您只需查看自己的问题历史记录,即可关注所有项目的时间表。 – 2012-05-02 13:23:13