Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
W
wiki-php
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • wiki-php
  • Wiki
  • code standard

Last edited by 互联网应用开发 Oct 29, 2024
Page history
This is an old version of this page. You can view the most recent version or browse the history.

code standard

风格要求


//下划线风格,操作符两边空格,字符串单引号
$user_name = '王小名';    
//函数 //大括号  , 参数列表空格
function eat_meat($type, $how_much) {  

}

//数组风格
$some_things = array(
    'name'=>'小小',
    'sex'=>'石头'
);
//单行注释

/*
多行
注释
*/


/**
 * 我是整个函数的说明
 * @param string $a  我是a的说明
 * @param int $b  我是b的说明
 * @return int $c  
 */
function im_func($a, $b){
    return $c;
}

强制规定

  1. 代码风格强制使用上述规则
  2. 函数必须写注释
  3. 不得循环查询数据库
  4. 全局变量使用需通报所有人
  5. 不得在controller里查询数据库
  6. 不得在view层查询数据库
  7. 变量名不得出现拼音
  8. 变量名的长度超过3;
  9. 变量使用前须声明

额外推荐

  1. 变量名超过5
  2. 不得对对象使用未声明的属性
Clone repository
  • 360safeguardnativeapi
  • all new classmate
  • bind phone
  • code standard
  • deploy_sys
  • edit common
  • edit master
  • envrioment
  • find psw
  • front new classmate
  • front statck
  • git
  • Home
  • idcard md5
  • ide
View All Pages