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: [...]由亚历克标签: [ … … ]