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 - - how to comment out php 如何评论出的PHP - - comentario php comentario的PHP - - comment out php code 评论指出PHP代码 - - php coments PHP的coments - - php comment PHP的评论 - - php coment PHP的coment - - 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 - - remark out php 这句话出来的PHP - - php comment blocks PHP的评论座 - - comentario no php comentario没有PHP的 - - comentário php comentário的PHP - - comment blocks for myspace 评论块MySpace上 - - PHP comentario PHP的comentario - - comment out a block of code in unix 评论了一个代码块在Unix - - como comentar em PHP 科摩comentar在PHP中 - - myspace comment bocks MySpace上评论bocks - - comment out a block of php 评论了一个座的PHP - - 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 挪威的评论守则 - -