Home > Backend Development > PHP Tutorial > php定名、注释规范

php定名、注释规范

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:20:46
Original
865 people have browsed it

php命名、注释规范

一、注释

1.文件头部模板

/** *这是一个什么文件 * *此文件程序用来做什么的(详细说明,可选。)。 * @author      richard<[email&#160;protected]> * @version     $Id$ * @since        1.0 */  
Copy after login

2.函数头部注释

/** * some_func  * 函数的含义说明 * * @access public * @param mixed $arg1 参数一的说明 * @param mixed $arg2 参数二的说明 * @param mixed $mixed 这是一个混合类型 * @since 1.0 * @return array */  public function thisIsFunction($string, $integer, $mixed) {return array();}  
Copy after login

3.类的注释

/** * 类的介绍 * * 类的详细介绍(可选。)。 * @author         richard<[email&#160;protected]> * @since          1.0 */  class Test   {  }  
Copy after login

4.程序代码注释

1). 注释的原则是将问题解释清楚,并不是越多越好。

2). 若干语句作为一个逻辑代码块,这个块的注释可以使用/* */方式。

3). 具体到某一个语句的注释,可以使用行尾注释://。

/* 生成配置文件、数据文件。*/    $this->setConfig();  $this->createConfigFile();  //创建配置文件  $this->clearCache();         // 清除缓存文件  $this->createDataFiles();   // 生成数据文件  $this->prepareProxys();  $this->restart();  
Copy after login

二、命名规范

http://alloyteam.github.io/code-guide/#project-naming

 

Related labels:
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
Latest Issues
Why is this ID written like this?
From 1970-01-01 08:00:00
0
0
0
Small question about $this
From 1970-01-01 08:00:00
0
0
0
javascript - es6中this
From 1970-01-01 08:00:00
0
0
0
This file demo.mp4
From 1970-01-01 08:00:00
0
0
0
What's the use of this?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template