PHP readfile() 함수
❮ PHP 파일 시스템 참조예시
파일 읽기:
<?php
echo readfile("test.txt");
?>
정의 및 사용
readfile() 함수는 파일을 읽고 출력 버퍼에 씁니다.
팁: fopen 래퍼가 php.ini 파일에서 활성화된 경우 이 기능과 함께 URL을 파일 이름으로 사용할 수 있습니다.
통사론
readfile(file, include_path, context)
매개변수 값
Parameter | Description |
---|---|
file | Required. Specifies the file to read |
include_path | Optional. Set this parameter to TRUE if you want to search for the file in the include_path (in php.ini) as well |
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream |
기술적 세부 사항
반환 값: | 성공 시 읽은 바이트 수, FALSE 및 실패 시 오류입니다. 함수 이름 앞에 '@'를 추가하여 오류 메시지를 숨길 수 있습니다. |
---|---|
PHP 버전: | 4.0+ |
PHP 변경 로그: | PHP 5.0: 컨텍스트 지원 추가 |
❮ PHP 파일 시스템 참조