file_put_contents ()のドキュメントには、次のように記載されています。
ファイル_追加:
追加はアトミックであり、ロックする理由がないため、LOCK_EX とは相互に排他的です。
LOCK_EX :
FILE_APPEND と相互に排他的です。
それでも、以下の数行に次のコードが表示されます。
<?php
$file = 'people.txt';
// The new person to add to the file
$person = "John Smith\n";
// Write the contents to the file,
// using the FILE_APPEND flag to append the content to the end of the file
// and the LOCK_EX flag to prevent anyone else writing to the file at the same time
file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
?>
では、FILE_APPEND フラグと LOCK_EX フラグは相互に排他的ですか? はいの場合、なぜ彼らは例でそれを使用していますか? これは不適切なドキュメンテーションのケースですか?
ご意見ありがとうございます。