Home >Backend Development >PHP Tutorial >How to use php to dynamically generate copyright information

How to use php to dynamically generate copyright information

不言
不言Original
2018-06-21 10:09:141687browse

This article mainly introduces the method of dynamically generating copyright information in PHP. It analyzes the operation skills of PHP time and string with examples. It has certain reference value. Friends in need can refer to the examples in this article.

Describes the method of dynamically generating copyright information in PHP. Share it with everyone for your reference. The specific implementation method is as follows:

function copyright($start, $owner) {
$date = date('Y');
 echo "© Copyright ";
 if ( $start < $date ) {
 echo "{$start} - ";
 }
 echo "{$date} {$owner}";
}

Demonstration example:

If the current year is 2013, use

copyright(&#39;2012&#39;, &#39;php.cn&#39;);

will output:

© Copyright 2012 - 2015 php.cn

The above is the entire content of this article, I hope it will be helpful to everyone Learning will be helpful. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Analysis of the implementation principles of scheduled tasks in PHP

About directory operations in PHP

The above is the detailed content of How to use php to dynamically generate copyright information. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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