站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
Gallery:编码标准
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
==命名惯例== Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code. In the block below, we'll refer to a capitalization strategy called '''CamelCase'''. In this strategy, multiple words are combined into one where the beginning of each internal word is capitalized. Acronyms are capitalized like regular words. There are two forms of '''CamelCase''': * '''UpperCamelCase''': The first letter is capitalized. (eg GalleryHelper, ImageLibrary) * '''lowerCamelCase''': The first letter '''''is not''''' capitalized. (eg maximumCpuSpeed, isAcceptable) {| border="1" cellpadding="5" cellspacing="0" | '''Type''' | '''Description''' | '''Example''' |- | Files |File names are in '''UpperCamelCase'''. Try to keep your file names simple and descriptive. Files that can be viewed directly by the browser should terminate in .php or .html. Files that are only intended to be included or required, should end in .inc. This is a security precaution to prevent code from being run out of context. Files that contain a PHP class definition should end in .class, and should also contain a class of the same name as the file. Exceptions: main.php, index.php, module.inc | ItemAdmin.inc<br/> GalleryEntity.class |- | Classes | Class names are in '''UpperCamelCase''' and should be nouns. Try to keep your class names simple and descriptive. Use whole words -- avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML and in that case, capitlize them as Url and Html). | class GalleryMap<br/> class UserDatabase<br/> class UrlGenerator<br/> |- | Variables | Variables are in '''lowerCamelCase'''. Private class members should start with an underscore (_), all other variable names should not start with an underscore. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic -- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables such as loop indexes. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. | var $fields;<br/> var $userInformation;<br/> var $_privateClassMember; |- | Functions | Functions are in '''lowerCamelCase''' and should be verbs. Functions that return boolean values should be in the form of a question as in isEnabled. The noun-verb formation makes code easier to read, eg "Is the user enabled?" becomes if ($user->isEnabled). Private class methods should start with an underscore, all other methods and functions should never start with an underscore. | function someFunction()<br/> function publicMethod()<br/> function _privateMethod() |- | Constants | The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores (_) (ANSI constants should be avoided, for ease of debugging). Constants used in localization should begin with an underscore. | $MIN_WIDTH = 4;<br/> $FULL_ONLY_MODE = 2; |- | Database Tables | Table names should use '''UpperCamelCase'''. Words should not be pluralized. | User<br/> UserGroupMap<br/> ChildEntity |- | Database Fields | Field names should use '''lowerCamelCase'''. Fields should avoid using numbers as this usually indicates failure to follow 3rd Normal Form (3NF). | userName<br/> modificationTimestamp<br> linkId |}
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)