Login   Register  
PHP Classes
elePHPant
Icontem

File: v2/tests/test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of jstar88  >  Safe IO  >  v2/tests/test.php  >  Download  
File: v2/tests/test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Safe IO
Access files using locks to prevent corruption
Author: By
Last change:
Date: 1 year ago
Size: 346 bytes
 

Contents

Class file image Download
<?php

include("../ConcurrentFile.php");

$file = new ConcurrentFile("data.txt");
$file->write("hello world");
$contents $file->read();
$file->close();
echo 
$contents;


$file = new ConcurrentFile("data.txt");
$file->writeLock();
$file->write("hello world");
$contents $file->read();
$file->releaseLock();
$file->close();
echo 
$contents;


?>