Login   Register  
PHP Classes
elePHPant
Icontem

File: Files.inc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Alexander Zhukov  >  PHP Shelve  >  Files.inc.php  >  Download  
File: Files.inc.php
Role: ???
Content type: text/plain
Description: File object passed to Pickle/Unpicle object
Class: PHP Shelve
Simple persistence mechanism for php objects
Author: By
Last change:
Date: 12 years ago
Size: 524 bytes
 

Contents

Class file image Download
<?
// (C) 2002, Alexander Zhukov <alex@veresk.ru>
class File {

	var $_file;

	function File($file)
	{
		$this->_file = $file;
	}

 	function read()
	{
		$fh = @fopen($this->_file,"rb");
		$str = @fread($fh,filesize($this->_file));
		@fclose($fh);
		return $str;
	}
	
	function write($str)
	{
		$fh = @fopen($this->_file,"wb");
		@fwrite($fh,$str);
		@fclose($fh);
	}
	
	function exists()
	{
		return @is_file($this->_file);	
	}
	
	function delete()
	{
		@unlink($this->_file);
	}
	
}
?>