Comments and Comment Blocks in PHP意見和評論座在PHP
PHP supports C language, C++ programming language and Unix shell-style (Perl style) comments. PHP支持C語言, C + +編程語言和UNIX shell風格(的Perl風格)的意見。 In PHP, // or # is used to make a single-line comment or /* and */ to make a large comment block that spans several lines.在PHP中, / /或#是用來製造一個單一的網上評論或/ *和* /作出評論座大跨越幾行。
For example:例如:
<?php < ? PHP的
echo ‘This is a test’; //This is a single-line C++ style comment迴聲'這是一個測試' ; / /這是一個單行的C + +作風評論
echo ‘This is another test’;#This is another single-line shell-style comment迴聲' ,這是另一項測試' ; #這是另一種單行shell風格評論
/* This is a multi line comment / *這是一個多行發表評論
Second line of comment */第二行評論* /
?> ? >
The “one-line” comment styles comment to the end of the line or the current block of PHP code, whichever comes first. “一線”的評論風格的評論,到去年底,該行或當前塊的PHP代碼,以先到者為準。 This means that HTML code after the PHP script block (PHP mode broken with ?> and returns to HTML mode after end of PHP code block) will be printed.這意味著, HTML代碼後, PHP腳本塊( PHP的模式打破了? >和效益為HTML模式結束後的PHP代碼塊)將刊印。 If the asp_tags configuration directive is enabled, it behaves the same with // %> and # %>.如果asp_tags配置指令啟用時,它的表現同樣/ / % >和# % > 。 However, the </script> tag doesn’t break out of PHP mode in a single-line comment.但是, “ < /腳本>標記不會擺脫PHP的模式在一個單一的在線評論。
For example,舉例來說,
<h1>This is an <?php # echo ’simple’;?> example.<h1> <h1>快來,這是一個< ? PHP的#迴聲'簡單' ; ? >的例子。 <h1>快來
<p>The header above will say ‘This is an example’.</p> <p>標題以上的人會說'這是一個例子' 。 < / >
C or C++ style comments end at the first */ encountered. C或C + +風格的註釋年底,在第一次* /遇到的。 Any nested /* and */ style comments will cause error, and it’s pretty easy to make this mistake if you are trying to comment out a large block of code.任何嵌套/ *和* /作風的意見,會造成錯誤,並且它的方法很簡單,使這個錯誤如果您想嘗試註釋掉一大段的代碼。
<?php < ? PHP的
/* / *
echo ‘This is a test’; /* This comment will cause a problem */迴聲'這是一個測試' ; / *此評論會造成的問題* /
*/ * /
?> ? >
The PHP comments is useful when you want to comment or disable a large portion of HTML. PHP的評論是有用的當您想要評論或禁用其中相當大一部分的HTML 。 Instead comment the HTML code line by line, put the whole HTML block into PHP code block (ie, add <?php and ?>) and comment with /* and */.而不是評論的HTML代碼線,由線,把整個的HTML座到PHP代碼塊(即,添加< ? PHP和? > )和評論/ *和* / 。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- 3 Column Relaxation WordPress Theme comments-paged.php for Paged-Comments WordPress Plugin三欄放寬的WordPress主題的評論- paged.php為分頁-評論wordpress插件
- Fight and Stop Comment Spam and Trackback Spam with Akismet打擊和制止垃圾評論和跟踪垃圾郵件akismet
- Integrate WordPress including Comments with bbPress Forum using bbSync整合WordPress所包括的評論與bbpress論壇使用bbsync
- PHP Parse Error: syntax error, unexpected $end PHP的解析錯誤:語法錯誤,意想不到的元月底
- How to Add and Put Picture or Image in MySpace Comment如何添加和付諸表決,圖片或影像在MySpace上評論
- Reduce Server Load Using Akismet to Automatically Discard Spam Comments on Posts Older than A Month減少服務器負載使用akismet自動丟棄垃圾郵件的評論對職位的老年人超過1個月
- Free Download: Akismet for WordPress Plugin 2.0 to Stop Comment, Trackback and Pingback Spam免費下載: akismet為wordpress插件2.0停止評論,跟踪和pingback垃圾郵件
- Stop Comment, Pingback and Trackback Spam with New Version of Akismet停止評論, pingback和跟踪垃圾郵件新版本的akismet
- WordPress 2.2 Released for Free Download在WordPress 2.2發布免費下載
- Rapid Leech Download from RapidShare, MegaUpload, Uploading, MyTempDir and Other File Sharing Services to Server水蛭快速下載rapidshare , megaupload ,上載, mytempdir和其他文件共享服務的服務器



















July 26th, 2006 06:45 2006年7月26日06:45
[...] [ … … ] http://www.mydigitallife.info/2006/04/26/dis… http://www.mydigitallife.info/2006/04/26/dis … . 。 [...] [ … … ]
December 10th, 2007 01:30 2007年12月10日01:30
[...] tip of the hat to My Digital Life for his article - Comments and Comment Blocks in PHP. [ … … ]提示的帽子,以我的數位生活,為他的文章-的意見和評論座在P HP。 By Alec Tags: [...]由亞歷克標籤: [ … … ]