The following code does not update the file creation date when php deletes and re-creates a file: PHPcodevar_dump (unlink (& quot; update1.log & quot ;)); // true $ handle = fopen (& quot; update1.log & quot;, & quot; w & quot ;); the file creation date is not updated when php deletes the file and re-creates it.
The code is as follows:
PHP code
Var_dump (unlink ("update1.log"); // true $ handle = fopen ("update1.log", "w"); // create a file fwrite ($ handle, date ("Y-m-d H: I: s"); fclose ($ handle );
The expected result is that the creation time of update1.log can be changed to the time when the fopen () file is created.
The actual result is that the creation time of update1.log is always the time of the first creation, as if there was no unlink.
Puzzling ~
Could anyone please help me solve this problem ~
PS: My operating system is win7
------ Solution --------------------
A few upstairs are a bit taken for granted
The fact is indeed the same as that observed by the landlord, at least in the window system.
But this has nothing to do with php, and it is the reason for the file system.
It is estimated that the directory item is not cleared when the file is deleted (only the delete flag is used), and the original directory item is used when the file is created again.
It can be considered that the "file creation time" should be the time when the directory item was created.
Php has the function filectime to get the time.
------ Solution --------------------
Discussion
What I said upstairs makes sense. Does anyone know what the situation is in linux?