Home  >  Article  >  Backend Development  >  PHP起点

PHP起点

WBOY
WBOYOriginal
2016-06-23 14:29:401144browse

PHP注释风格, 书写代码中注释是非常重要的, 清晰的注释能提高你的代码阅读性, 团队开发中只需要看你的注释不需要再看代码能节省大量的时间. 也能为自己起到备忘的作用.

下面我们来看一下PHP代码有几种注释方法:

1.C++单行注释风格

1 <?php2 echo ‘使用C++风格’;  // 这是C++单行注释风格3 ?>

2.C++多行注释风格

1 <?php 2 /*这是C3 *的多行注释风格4 */    5 echo ‘使用C风格的多行注释’;  // 这是C风格的多行注释6 ?>

3.shell脚本注释风格

1 <?php    2 echo ‘这是shell脚本风格的注释’;  # 这是shell脚本注释风格3 ?>

注意:// 在单行注释中不能出现?>标记, 否则会被认为是PHP结束标记;

 

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