Friday, August 21, 2020

Using the PHP Function to Find When a File Was Modified

Utilizing the PHP Function to Find When a File Was Modified On the off chance that your site contains time-touchy data or regardless of whether it doesnt-you might need to show the last time a record was changed on the site. This gives clients a precise thought of how state-of-the-art the data on a page is. You can naturally draw this data from the record itself utilizing the ​filemtime() PHP work. The filemtime() PHP work recovers the Unix timestamp from the document. The date work changes over the Unix timestamp time. This timestamp shows when the record was last changed. Model Code to Display File Modification Dateâ At the point when you utilize this code,â replace myfile.txt with the genuine name of the document you are dating.​ ?php/yields myfile.txt was last altered: December 29 2002 22:16:23. $filename myfile.txt; if (file_exists($filename)) {â â echo $filename was last altered: . date (F d Y H:i:s., filemtime($filename)); } ? Different Uses for Filemtime() Function Notwithstanding time-stepping web articles, the filemtime() capacity can be utilized to choose all articles more established than a predetermined time to erase every single old article. It can likewise be utilized to sort articles by age for different purposes. The capacity can prove to be useful when managing program reserving. You can drive the download of a reconsidered variant of a template or page utilizing the filemtime()â function. Filemtime can be utilized to catch the change time of a picture or other document on a remote site. Data on Filemtime() Function The resultsâ of the filemtime() work are reserved. Theâ clearstatcache() work clears the cache.If the filemtime () work falls flat, the code returns bogus.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.