표준 PHP 라이브러리(SPL) SplFileObject::fpassthru
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fpassthru — 파일 포인터에 남아 있는 모든 데이터 출력
설명
public SplFileObject::fpassthru(): int
현재 위치에서 지정된 파일 포인터의 EOF를 읽고 결과를 출력 버퍼에 씁니다.
파일에 이미 데이터를 쓴 경우 SplFileObject::rewind()를 호출하여 파일 포인터를 파일의 시작 부분으로 재설정해야 할 수도 있습니다.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
handle
에서 읽고 출력으로 전달된 문자 수를 반환합니다.
Examples
예제 #1 SplFileObject::fpassthru() 예제
<?php
// Open the file in binary mode
$file = new SplFileObject("./img/ok.png", "rb");
// Send the right headers
header("Content-Type: image/png");
header("Content-Length: " . $file->getSize());
// Dump the picture and end script
$file->fpassthru();
exit;
?>
기타
- fpassthru() - 파일 포인터에 남아 있는 모든 데이터 출력