How To Display Current Year in PHP ¿Cómo mostrar el año en curso en PHP
The most common use of this is to display the current year in the copyright message dynamically. El uso más común de esto es para mostrar el año en curso en el mensaje de forma dinámica los derechos de autor. Anyone who really knows PHP should be able to do it easily. Cualquier persona que realmente sabe de PHP debe estar en condiciones de hacerlo fácilmente. However not everyone who has to use PHP knows PHP, like, for example, people using snippets in ModX or modifying templates in WordPress. Sin embargo no todo el mundo que tiene que usar PHP PHP sabe, como, por ejemplo, las personas que utilizan fragmentos en ModX o modificar las plantillas de WordPress. Here is the code snippet for them: Aquí está el fragmento de código para ellos:
Filed under Filed under How To Cómo , Open Source Software Open Source Software , PHP , Programming Programación , Web , Web 2.0 Web 2,0 , WordPress | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artículo |
Email this Article Enviar artículo
You may also like to read También puede leer |





March 1st, 2008 at 12:25 pm 1 de marzo de 2008 a 12:25 pm
You might have better luck with the following since your PHP tag is incorrect: Puede que tenga mejor suerte con el siguiente PHP ya que su etiqueta es incorrecta:
March 1st, 2008 at 12:28 pm 1 de marzo de 2008 a 12:28 pm
Um er… Your comment filter killed my code so here it is: Um er… Tu comentario filtro mató a mi código así que aquí está:
<?php date(’Y'); ?> <? php date ( 'Y');?>
March 1st, 2008 at 12:29 pm 1 de marzo de 2008 a 12:29 pm
3rd Try is the charm: 3 ª Prueba es el encanto:
<?php date(’Y'); ?> <? php date ( 'Y');?>
March 2nd, 2008 at 3:14 am 2 de Marzo, 2008 a 3:14 am
The code is correct. El código es correcto. Semicolon is not required before ending PHP tag. Punto y coma no es necesaria antes de poner fin a PHP tag.
March 2nd, 2008 at 1:14 pm 2 de Marzo, 2008 a 1:14 pm
You are right that the ending semi-colon is not required but the “?” is required to set off the PHP tag it won’t be parsed and will not appear as the browser will parse it as if it were an unknown HTML element. Tiene usted razón que la que termina el punto y coma no es necesaria pero el "?" Es necesaria para compensar la etiqueta de PHP no será analizada y no aparecerá como el navegador va a analizar como si se tratara de un elemento desconocido HTML.