file_put_contents

(PHP 5)

file_put_contents -- Write a string to a file

Description

int file_put_contents ( string filename, string data [, int flags [, resource context]])

Identical to calling fopen(), fwrite(), and fclose() successively. The function returns the amount of bytes that were written to the file.

flags can take FILE_USE_INCLUDE_PATH and/or FILE_APPEND, however the FILE_USE_INCLUDE_PATH option should be used with caution.

참고: 이 함수는 바이너리 호환(binary-safe)입니다.

작은 정보: fopen wrappers를 설정하면, 이 함수의 파일 이름으로 URL을 사용할 수 있습니다. 파일 이름을 지정하는 방법은 fopen()을 참고하고, 지원하는 URL 프로토콜 목록은 부록 J를 참고하십시오.

See also: fopen(), fwrite(), fclose(), and file_get_contents().