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

PHP - 添加注释

WBOY
Release: 2016-06-13 12:21:08
Original
1137 people have browsed it

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>?>
Copy after login

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>?>
Copy after login

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>?>
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template