This article describes the method of automatically updating the display of copyright information in php. Share it with everyone for your reference. The specific analysis is as follows:
We usually output copyright information at the bottom of the page, including 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; } //用法: print '© ' . autoUpdatingCopyright(2001) . ' jb51.net'; /* Output: (c) 2001-2012 jb51.net */
I hope this article will be helpful to everyone’s PHP programming design.