js
<script>document.write(new Date().getFullYear());</script>
php
<?php echo date("Y");?>
例如:
<p class="copyright">Copyright © <script>document.write(new Date().getFullYear());</script> <a href="https://">xxx</a> All Rights Reserved.</p>
当然你还可以
<script type="text/javascript"> copyright=new Date();//取得当前的日期 update=copyright.getFullYear();//取得当前的年份 document.write("Copyright © 2016-"+ update + ' <a href="/"><b>xxx</b></a> All rights reserved. '); </script>
这样做好网站后就不用每年再去修改 foot 了