After the linux file is operated through PHP file_put_contents, the size of the file is twice as large as the number of bytes written

$str = "aaa" . "\n";
echo file_put_contents("/tmp/log", $str, FILE_APPEND); //4

after querying through the linux command, the screenshot is as follows

I hope Daniel can help me answer my question about why the size of the file is growing by twice the number of bytes written

.
Apr.04,2021

FILE_APPEND is the append flag. If there is content in it will be directly appended, you cat this file to see if the content is aaa+ enter?

Menu