PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<指令分隔符类型>
Last updated: Mon, 16 Jul 2012

注释

PHP 支持 'C','C++' 和 Unix Shell 风格的注释。例如:

<?php
  
echo "This is a test"; // This is a one-line c++ style comment
   /* This is a multi line comment
       yet another line of comment */
  
echo "This is yet another test";
   echo
"One Final Test"; # This is shell-style style comment
?>

“单行”注释仅仅注释到行末或者当前的 PHP 代码块,视乎哪个首先出现。

<h1>This is an <?php # echo "simple";?> example.</h1>
<p>The header above will say 'This is an example'.

小心不要嵌套 'C' 风格的注释,当注释大量代码时,可能犯该错误。

<?php
 
/*
   echo "This is a test"; /* This comment will cause a problem */
 
*/
?>

“单行”注释仅仅注释到行末或者当前的 PHP 代码块,视乎哪个首先出现。这意味着 // ?> 后面的 HTML 代码将被打印出来:?> 跳出了 PHP 模式并且返回 HTML 模式,而且 // 注释符并不会影响到模式的转换。




<指令分隔符类型>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST