Home > Article > Backend Development > How to use php to dynamically generate copyright information
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('2012', 'php.cn');
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!