标签:echo flush php put fclose close 利用 before flock
<?php $fp = fopen(‘/tmp/file.lock‘, "a+"); if(flock($fp, LOCK_EX)) { //进行排他型锁定 fwrite($fp, "lock success\n"); fflush($fp); //flush output before releasing the lock flock($fp, LOCK_UN); //释放锁定 } else { echo "文件正在被其他进程占用"; } fclose($fp); ?>
标签:echo flush php put fclose close 利用 before flock
原文地址:http://www.cnblogs.com/dongruiha/p/6401023.html