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 In the event that your site contains time-touchy data or regardless of whether it doesnt-you might need to show the last time a document was adjusted on the site. This gives clients an exact thought of how forward-thinking the data on a page is. You can naturally draw this data from the document 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 document was last changed. Model Code to Display File Modification Dateâ At the point when you utilize this code,â replace myfile.txt with the real name of the record you are dating.​ ?php/yields myfile.txt was last changed: 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 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 changed variant of a template or page utilizing the filemtime()â function. Filemtime can be utilized to catch the alteration time of a picture or other record 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 comes up short, the code returns bogus.

No comments:

Post a Comment

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