xiaozi 2014-12-10 23:35:09

fopen以append模式打开文件时,fwrite本身就是原子操作(除非string大于系统的block size,一般为4k),不需要使用flock

<?php

$fd = fopen('test.txt', 'a+');
// flock($fd);
fwrite($fd, '测试内容');
fclose($fd);

评论

- 위키
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-08 17:50
浙ICP备14020137号-1 $방문자$