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 我的數字生活論壇 .



2 Responses to “Comments and Comment Blocks in PHP” 2反應“的意見和評論座在PHP ”

  1. E-Volution IT » Blog Archive » Windows Genuine Advantage circumvention電子volution它»博客存檔» Windows Genuine Advantage的規避
    July 26th, 2006 06:45 2006年7月26日06:45
    1

    [...] [ … … ] http://www.mydigitallife.info/2006/04/26/dis… http://www.mydigitallife.info/2006/04/26/dis … . [...] [ … … ]

  2. How to Comment Code in WordPress Templates如何評論代碼在WordPress模板
    December 10th, 2007 01:30 2007年12月10日01:30
    2

    [...] tip of the hat to My Digital Life for his article - Comments and Comment Blocks in PHP. [ … … ]提示的帽子,以我的數位生活,為他的文章-的意見和評論座在P HP。 By Alec Tags: [...]由亞歷克標籤: [ … … ]

Leave a Reply離開的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <刪除日期時間= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting訂閱無評論


Custom Search

New Articles新的條款,

Incoming Search Terms for the Article傳入的搜索條件文章

comment out php 評論指出的PHP - - php comment out PHP的評論指出 - - comentario em php 在PHP中comentario - - comentário em php comentário在PHP中 - - comment out in php 評論指出在PHP - - comentario php comentario的PHP - - comment out php code 評論指出PHP代碼 - - php coments PHP的coments - - how to comment out php 如何評論出的PHP - - php coment PHP的coment - - php comment PHP的評論 - - how to comment out PHP code 如何評論指出PHP代碼 - - commenting out in php 評論指出在PHP - - free coments 免費coments - - php comment block of code PHP的評論代碼塊 - - myspace comment blocks MySpace上評論座 - - coment php coment的PHP - - php comment blocks PHP的評論座 - - comentário php comentário的PHP - - comment blocks for myspace 評論塊MySpace上 - - PHP comentario PHP的comentario - - remark out php 這句話出來的PHP - - comment out a block of code in unix 評論了一個代碼塊在Unix - - como comentar em PHP 科摩comentar在PHP中 - - comentario no php comentario沒有PHP的 - - myspace comment bocks MySpace上評論bocks - - php comment out blocks PHP的評論指出座 - - php commenting PHP的評論 - - php commenting out PHP的評論指出 - - php comment a block of code PHP的評論代碼塊 - - comment out block of php 評論指出座的PHP - - php comment block PHP的評論座 - - comment block in unix 評論座在Unix - - coment in php coment在PHP - - comment blocks on myspace 評論座在MySpace - - hOW TO coment in PHP 如何在PHP coment - - "comentario em php" “ comentario在PHP的” - - comentários em php comentários在PHP中 - - comentario en php comentario英文的PHP - - php coments code PHP的coments代碼 - - php block of comment PHP的座的評論 - - PHP commenting out a block of code PHP的評論了一個代碼塊 - - free coments on internet 免費coments在互聯網上 - - comment block for myspace 評論座為MySpace上 - - comentar php comentar的PHP - - comments tag block in pHP 評論標籤座在PHP - - italian coments about life 意大利coments生活 - - PHP + commenting PHP中+評論 - - norsk comments code 挪威的評論守則 - - comment in PHP 評論在PHP - -