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

How to use php to dynamically generate copyright information

不言
Release: 2023-04-01 15:42:02
Original
1693 people have browsed it

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}";
}
Copy after login

Demonstration example:

If the current year is 2013, use

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

will output:

© Copyright 2012 - 2015 php.cn
Copy after login

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!

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template