开发者

how to get file contents of locked file in PHP

开发者 https://www.devze.com 2023-03-05 07:45 出处:网络
What\'s the best way, idiomatically, of getting the file contents (into a string) of a flock\'d file in PHP?

What's the best way, idiomatically, of getting the file contents (into a string) of a flock'd file in PHP?

Edit: To be clear, this is something 开发者_StackOverflow中文版locked by the current page/process. Something like:

if(flock($fp ...)) {
  $str = READFILECONTENTS($fp);
  flock(...);
}


Don't. Wait for the lock to be released and only then read it.

Or just read it anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消