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++的禁令
立即学习“PHP免费学习笔记(深入)”;
<?<span style="color: #000000;">php </span><span style="color: #0000ff;">echo</span> 'Hello,PHP!'; <span style="color: #008000;">#</span><span style="color: #008000;">我是注释,不被执行</span>?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号