Home >Backend Development >PHP Tutorial >PHP - 添加注释

PHP - 添加注释

WBOY
WBOYOriginal
2016-06-13 12:21:081110browse

PHP -- 添加注释

PHP支持3种风格的注释

1.C++风格(//)的注释

这种注释不能出现?>标记,如果开启short_open和asp_tag设置,>和%>同样不能出现在注释中

<span style="color: #000000;">php    </span><span style="color: #0000ff;">echo</span> 'Hello,PHP!';     <span style="color: #008000;">//</span><span style="color: #008000;">我是注释,不被执行    </span>?>

2.C语言风格,不允许嵌套注释

<span style="color: #000000;">php    </span><span style="color: #008000;">/*</span><span style="color: #008000;">    *我是注释,不被执行    </span><span style="color: #008000;">*/</span>    <span style="color: #0000ff;">echo</span> ‘Hello,PHP!<span style="color: #000000;">’;</span>?>

3.Shell风格,同C++的禁令

<span style="color: #000000;">php    </span><span style="color: #0000ff;">echo</span> 'Hello,PHP!';   <span style="color: #008000;">#</span><span style="color: #008000;">我是注释,不被执行</span>?>

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn