认为加锁的代码
php的flock不怎么好用
这里给出一种认为加锁的方法
<?
function lock($file){
$data=fopen($file.".lck","w");
fclose($data);
//加锁
function unlock($file){
if(
unlink($file.".lck"))return 1; else return 0;
//去除加锁
function locked($file){
if(
file_exists($file.".lck")) return 1; else return 0;
//判断是否可以写入
?>