This article mainly introduces how php automatically updates the display of copyright information. The example shows how php selects the display mode based on time, for more information about how to automatically update copyright information in php, see the following example. Share it with you for your reference. The specific analysis is as follows:
We usually output copyright information at the bottom of the page, including the year information, which needs to be modified every year. This simple code will help you solve this problem and automatically update the year.
Function autoUpdatingCopyright ($ startYear) {// given start year (e.g. 2004) $ startYear = intval ($ startYear); // current year (e.g. 2007) $ year = intval (date ('Y'); // is the current year greater than the // given start year? If ($ year> $ startYear) return $ startYear. '-'. $ year; else return $ startYear;} // Usage: print'©'. AutoUpdatingCopyright (2001). 'bitscn.com';/* Output :( c) 2001-2012 bitsCN.com */
I hope this article will help you with php programming.