PHP Classes

File: v2/tests/test.php

Recommend this page to a friend!
  Classes of Nicola Covolo   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: Update of v2/tests/test.php
Date: 2 months 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;


?>