php代码 多个进程共同写入一个文件成功

<?php
$file = fopen("test.php", "w+");
if(flock($file, LOCK_EX)){
    fwrite($file, 'write something');
    flock($file, LOCK_UN);
}else{
    echo 'errer file locking';
}
fclose($file);
?>


你可能感兴趣的:(php代码 多个进程共同写入一个文件成功)