kevinritt Posted April 26, 2009 Share Posted April 26, 2009 Is there a function or other code that can be placed on a page and show when a particular page was requested? Thanks Link to comment https://forums.phpfreaks.com/topic/155682-is-there-a-way-to-see-the-time-that-a-php-page-was-requested-from-the-server/ Share on other sites More sharing options...
Prismatic Posted April 26, 2009 Share Posted April 26, 2009 <?php echo time(); ?> This will output a unix timestamp of the current time, you can format it with date() Link to comment https://forums.phpfreaks.com/topic/155682-is-there-a-way-to-see-the-time-that-a-php-page-was-requested-from-the-server/#findComment-819440 Share on other sites More sharing options...
WolfRage Posted April 26, 2009 Share Posted April 26, 2009 A much better way howeverwould be to use the prebuilt variable. <?php echo $_SERVER['REQUEST_TIME']; ?> Link to comment https://forums.phpfreaks.com/topic/155682-is-there-a-way-to-see-the-time-that-a-php-page-was-requested-from-the-server/#findComment-819442 Share on other sites More sharing options...
Prismatic Posted April 26, 2009 Share Posted April 26, 2009 A much better way howeverwould be to use the prebuilt variable. <?php echo $_SERVER['REQUEST_TIME']; ?> Never trust $_SERVER. Link to comment https://forums.phpfreaks.com/topic/155682-is-there-a-way-to-see-the-time-that-a-php-page-was-requested-from-the-server/#findComment-819443 Share on other sites More sharing options...
WolfRage Posted April 26, 2009 Share Posted April 26, 2009 Ahh Negative, yes trust $_SERVER. Never trust certian strings provided to the sever from the user such as thier user agent or IP address. As stated by the PHP maual the entries in this array are created by the serve it's self, If the server provides the information and it is not gathered from a outside source is it reliable. After all if you can not trust your server, what can you trust. One more point compare time to the REQUEST_TIME, which comes first? Ahh and you see you are causing undue overhead, by calling a function that has already been set up for you. Link to comment https://forums.phpfreaks.com/topic/155682-is-there-a-way-to-see-the-time-that-a-php-page-was-requested-from-the-server/#findComment-819445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.