我有这个网址www.example.com/1.png
。我想运行一个循环,如下所示:
for ($i=0; $i<=10; $i++){
$url = 'www.example.com/'.$i.'.png';
}
现在我有 10 个网址。假设 10 个网址中有 7 个是图片,而其他 3 个不可用。我想从每个 o url 下载图像,如果 url 不存在,那么它不会下载任何东西。
这是同样的事情,但我认为更基本的解释是:
www.example.com/1.png --- url exists, so i download the image and save it in my folder.
www.example.com/2.png --- url exists, so i download the image and save it in my folder.
www.example.com/3.png --- url doesnt exist, so i dont download anything
www.example.com/4.png --- url exists, so i download the image and save it in my folder.
www.example.com/5.png --- url exists, so i download the image and save it in my folder.
www.example.com/6.png --- url exists, so i download the image and save it in my folder.
www.example.com/7.png --- url doesnt exist, so i dont download anything
www.example.com/8.png --- url exists, so i download the image and save it in my folder.
www.example.com/9.png --- url exists, so i download the image and save it in my folder.
www.example.com/10.png --- url doesnt exist, so i dont download anything
抱歉英语不好,有什么建议可以解决这个问题吗?