PHP fwrite() 함수
❮ PHP 파일 시스템 참조예시
열린 파일에 쓰기:
<?php
$file = fopen("test.txt","w");
echo fwrite($file,"Hello World. Testing!");
fclose($file);
?>
위 코드의 출력은 다음과 같습니다.
21
정의 및 사용
fwrite()는 열린 파일에 씁니다.
함수는 파일 끝(EOF) 또는 지정된 길이에 도달할 때 중 먼저 도래하는 시점에서 중지됩니다.
통사론
fwrite(file, string, length)
매개변수 값
Parameter | Description |
---|---|
file | Required. Specifies the open file to write to |
string | Required. Specifies the string to write to the open file |
length | Optional. Specifies the maximum number of bytes to write |
기술적 세부 사항
반환 값: | 쓴 바이트 수, 실패 시 FALSE |
---|---|
PHP 버전: | 4.0+ |
바이너리 금고: | 네 |
❮ PHP 파일 시스템 참조