2010-04-28 10 views
15

PHP의 file_get_contents() 함수에서 파일 내용을 가져 오는 중이며 해당 파일을 특정 폴더에 저장하고 싶습니다. 내가 어떻게 그럴 수 있니?php : 파일 내용 가져 오기 및 특정 폴더에 파일 저장

$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif'); 

이 이미지를 특정 폴더에 저장하고 싶습니다.

그것에 대해 궁금한 점이 있으십니까? 당신이 PHP 5를 사용하는 경우

답변

35

사용 file_put_contents()

$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif'); 
file_put_contents('./myDir/myFile.gif', $image); 
3

, 당신은 file_put_contents 사용할 수 있습니다

file_put_contents('/path/to/file.dat', $data);