PHP first Delete and re-create a file when the creation date of the file is not updated on the issue

Source: Internet
Author: User
PHP first Delete and re-create a file when the creation date of the file is not updated
The code is as follows:
PHP Code
  
  Var_dump (Unlink ("Update1.log"));  True$handle=fopen ("Update1.log", "w"); Create 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 fopen () time when the file was created.

The actual result is that the creation time of the Update1.log has been the first time it was created, as if there were no unlink ().

We can't think of the solution ~

I beg you prawns who can help to dispel the question ~

PS: My operating system is Win7

------Solution--------------------
Some of the upstairs guys take it for granted

It is true that the landlord observes the same thing, at least in the window system.

But this has nothing to do with PHP, it's the file system.
It is estimated that the directory entry was not cleared when the file was deleted (only the delete flag) and the original catalog item was used when it was created again
You can think of "File creation time" as the time when the catalog item was created

PHP has the function to get that time filectime


------Solution--------------------
Explore

There's a point upstairs, who knows what's going on under Linux?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.