php注释

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

<?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 代码块,视乎哪个首先出现。这意味着在 // ?> 之后的 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'.

C 风格的注释在碰到第一个 */ 时结束。小心不要嵌套 C 风格的注释,当注释大量代码时,可能犯该错误。

<?php
 
/*
    echo "This is a test"; /* This comment will cause a problem */
 
*/
?>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值