Answer the question
In order to leave comments, you need to log in
Why flock does not work, what to do?
$file_name = 'text.json';
$fp = fopen($file_name, "r+");
flock($fp, 2);
$array = fread($fp, filesize($file_name));
//flock($fp, LOCK_UN);
fclose($fp);
$fp = fopen($file_name, "w+");
flock($fp, 2);
fwrite($fp, $array+1); //здесь отработает
flock($fp, 3);
fclose($fp);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question