класс чтения файлов
Добавлено: Пт дек 16, 2005 19:33
Мне нужно прочитать файл с помощью обьекта
вот класс чтения файлов
но этот класс выводит только последнии 255 символов.Если return засунуть внутрь while то выводятся первые 255 символов .как грамотно решить эту проблемму.
вот класс чтения файлов
Код: Выделить всё
class op_file
{
var $filename='';
var $rej=''; //Mode of reading
var $id_file='';
var $out='';
function __construct($filename,$rej)
{
$this->filename = $filename;
$this->rej = $rej;
$this->id_file = fopen($this->filename,$this->rej);
$this->out = $out;
}
function output_file()
{
while (!feof($this->id_file))
{
$this->out = fgets($this->id_file,255);
}
return $this->out;
}
function __destruct()
{
fclose($this->id_file);
}
}
$conten = new op_file('model.txt',r);
echo $conten->output_file();