나는이 URL을 가지고 있습니다. www.example.com/1.png
. 다음과 같이 루프를 실행하고 싶습니다.이미지가있는 경우 URL에서 이미지 다운로드
for ($i=0; $i<=10; $i++){
$url = 'www.example.com/'.$i.'.png';
}
이제 10x URL이 있습니다. 10 개의 URL 중 7 개가 이미지이고 나머지 3 개는 사용할 수 없습니다. 나는 각각의 URL에서 이미지를 다운로드하고 싶습니다. 그리고 URL이 존재하지 않는다면 아무 것도 다운로드하지 않을 것입니다.
는 Heres는 같은 일을하지만 난 생각보다 basicly 설명했다
이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
죄송합니다 나쁜 영어, 어떤 제안을 내가이 문제를 해결할 수있는 방법?
어디에서 문제가 발생합니까? 너 뭐 해봤 니? 파일 저장 기능을 모른다면 file_get_content()와 file_put_content()를 PHP 매뉴얼에서 찾으십시오. – aleation
'file_get_content()와 file_put_content()' – Edgar
감사합니다. 당신이 이미지를 얻는다면, 그렇지 않으면 그렇지 않을 것입니다. – deceze