您好,欢迎访问一九零五行业门户网

PHP注释掉代码有几种写法?分别是什么?

hp 支持 c,c++ 和 unix shell 风格(perl 风格)的注释。例如:
<?php echo "this is a test" ; // this is a one-line c++ style comment echo "this is yet another test" ; echo 'one final test' ; # this is a one-line shell-style comment ?>
单行注释仅仅注释到行末或者当前的 php 代码块,视乎哪个首先出现。这意味着在 // ... ?> 或者 # ... ?> 之后的 html 代码将被显示出来:?> 跳出了 php 模式并返回了 html 模式,// 或 # 并不能影响到这一点。如果启用了 asp_tags 配置选项,其行为和 // %> 或 # %> 相同。不过,</script> 标记在单行注释中不会跳出 php 模式。
<h1>this is an <?php # echo 'simple'; ?> example</h1> <p>the header above will say 'this is an example'.</p>
c 风格的注释在碰到第一个 */ 时结束。要确保不要嵌套 c 风格的注释。试图注释掉一大块代码时很容易出现该错误。
<?php */ ?>
php注释有两种:
用双斜杠 // 这种是注释掉一行代码比如
//$message = 'abc';
用 /* 和 */ 这种是注释掉一大段的,比如
/* $today = 'tomorrow'; */
以上就是php注释掉代码有几种写法?分别是什么?的详细内容。
其它类似信息

推荐信息