PHP работа с файлами

Чтение из файла....
$fh = fopen("data.txt", "r");
$temp="";
while (! feof($fh))
{
$temp.=fgets($fh, 4096);
}
fclose($fh);

Запись в фаил
$file = fopen ("main.inc.php","w");
if ($file ){
fputs ( $file, $temp);
}
fclose ($file);

Поделиться: Сохранить