Home > php教程 > php手册 > body text

php自动更新版权信息显示的方法

WBOY
Release: 2016-06-06 20:02:54
Original
944 people have browsed it

这篇文章主要介绍了php自动更新版权信息显示的方法,实例分析了php根据时间选择显示方式,需要的朋友可以参考下

本文实例讲述了php自动更新版权信息显示的方法。分享给大家供大家参考。具体分析如下:

我们一般会在页面下方输出版权信息,,包含年份信息,每年都要修改,这段简单的代码帮你解决这个问题,自动更新年份

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 */

希望本文所述对大家的php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template