Vote 投票 0 0
How To Display Current Year in PHP如何顯示本年度在PHP
Angsuman Chakraborty日由Angsuman Chakraborty
March 1st, 2008 2008年3月1日 The most common use of this is to display the current year in the copyright message dynamically.最常見的使用方式,這是為了顯示本年度在版權信息,動態。 Anyone who really knows PHP should be able to do it easily.任何人誰真正知道的PHP應該能夠這樣做很容易。 However not everyone who has to use PHP knows PHP, like, for example, people using snippets in ModX or modifying templates in WordPress.但不是每個人都誰已經使用PHP眾所周知的PHP , ,例如,人們使用片段在modx或修改模板在WordPress 。 Here is the code snippet for them:這裡是代碼段為他們:
Filed under提起下 How To如何 , , Open Source Software開放源碼軟件 , , PHP PHP的 , , Programming編程 , , Web網頁 , , Web 2.0 Web 2.0的 , , WordPress在WordPress | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |





March 1st, 2008 at 12:25 pm 2008年3月1日在下午12時25分
You might have better luck with the following since your PHP tag is incorrect:你可能有更好的運氣,具有下列以來,你的PHP標記是不正確:
March 1st, 2008 at 12:28 pm 2008年3月1日在下午12時28分
Um er… Your comment filter killed my code so here it is:嗯呃…您的評論過濾殺害我的代碼,所以這裡是:
<?php date(’Y'); ?> < ? PHP的日期(以Y ' ) ; ? >
March 1st, 2008 at 12:29 pm 2008年3月1日在下午12時29分
3rd Try is the charm:第三是嘗試的魅力:
<?php date(’Y'); ?> < ? PHP的日期(以Y ' ) ; ? >
March 2nd, 2008 at 3:14 am 2008年3月2日在上午03時14分
The code is correct.代碼是正確的。 Semicolon is not required before ending PHP tag.分號是不需要結束前PHP的標記。
March 2nd, 2008 at 1:14 pm 2008年3月2日在下午1時14分
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.您的權利,結束半結腸是不需要,但“ ? ”是需要一套小康PHP的標記,它不會被解析,並不會出現由於該瀏覽器將它作為解析,如果這是一個未知的HTML元素。