Last Modified date/time
开发者_Go百科I know we can use:
<?php
$last_modified = filemtime("profile.php");
print "Last modified " . date("l, dS F, Y @ h:ia", $last_modified);
?>
To display the last time the file was modified to the server.
But If this PAGE ( profile.php ) is a members profile page, and they MODIFY it, I want to echo the date and time they last modified it. ( ie. the content of the page ) not the physical php page itself.
Is there a line of code we can use, or is it slightly more complicated.
Ste
Yes, that is a much more complicated task. You're going to have to store the last modified time into a database (since you're saying users can modify their profile content I'll assume you already have a database). The easiest way to get the last time the user modified their profile depends on your schema.
To put it another way... what the user is actually modifying isn't "profile.php", it's some data that lives elsewhere, e.g. a MySQL database; so the system that's going to know when the user last modified it is that external data source.
Assuming you have a database for your users.....
You need to have a column where you store the date they created the account, and then update this value each time the user clicks "Save settings".
精彩评论