<?php header("content-type:text/html;charset=utf-8"); $fp = fopen("lock.txt","w+"); if(flock($fp, LOCK_EX)){// 进行排它型锁定 fwrite($fp,"Write something here\n"); flock($fp, LOCK_UN);// 释放锁定 }else{ echo "Couldn‘t lock the file !"; } fclose($fp); ?>
source:http://www.bcty365.com/content-10-2954-1.html
时间: 2024-11-05 12:45:04