Forum und email

fread

(PHP 4, PHP 5)

fread — Binary-safe 파일 읽기

Description

string fread ( int $fp , int $length )

fread()fp 에 의해 참조가 되는 파일 포인터로부터 length 를 바이트로 증가시키며 읽습니다. length 바이트가 읽혔거나 파일의 끝에 도달되거나 둘중에 먼저 끝나는 것이 있으면 읽기가 종료됩니다..

// 파일의 내용을 문자열로 가져오기
$filename = "/usr/local/something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, 파일의크기 ($filename));
fclose ($fd);

참조 fwrite(), fopen(), fsockopen(), popen(), fgets(), fgetss(), fscanf(), file(), and fpassthru().