File::read()

File::read() -- read bytes from a file

Synopsis

require_once 'File.php';

mixed File::read (string $filename [, int $size = FILE_DEFAULT_READSIZE [, mixed $lock = FALSE]])

Описание

File::read() reads a specific amount of bytes from a specified file and returns them to the user.

Параметр

Возвращаемое значение

mixed - this function returns the requested bytes from the file if there were no errors, FALSE if it reached EOF or a PEAR_Error object if an error has occured during reading from file.

Throws

Таблица 39-1. Возможные значения PEAR_Error

Error CodeError ValueMeaningSolution
NULL"File does not exist: $filename"The file $filename does not exist.Check if the path that is passed to the function is correct.
NULL"Failed to open file: $filename"There are few possible things that might cause that error, usually it's caused by wrong permissions or bad sectors on the harddisk.Check the permissions of the file (ls -l {file} on UNIX systems) and change them so the file is readable by PHP, check if the harddisk is working properly and has no bad sectors.

Заметка

Эта функция может быть вызвана статически.

См. также

File::readChar()
File::readLine()
File::readAll()

Пример


HIVE: All information for read only. Please respect copyright!
Hosted by hive йца: йХЕБЯЙЮЪ ЦНПНДЯЙЮЪ АХАКХНРЕЙЮ