研发规范
发布时间:2017-11-04 10:28:27
研发规范
目录和文件命名
-
目录命令使用小写加下划线。
-
类库、函数文件统一以.php为后缀。
-
类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致。
-
类文件采用驼峰法命名(首字母大写),其它文件采用小写加下划线命名。
-
类名和类文件名保持一致,统一采用驼峰法命名(首字母大写)。
函数和类、属性命名
-
类的命名采用驼峰法(首字母大写),例如 User。
-
函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 get_client_ip。
-
方法的命名使用驼峰法(首字母小写),例如 getUserName。
-
属性的命名使用驼峰法(首字母小写),例如 tableName、instance。
-
类名和类文件名保持一致,统一采用驼峰法命名(首字母大写)。
常量和配置命名
-
常量以大写字母和下划线命名,例如 APP_PATH。
-
配置参数以小写字母和下划线命名,例如 url_route_on。
数据表和字段命名
-
数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 think_user 表和 user_name字段,不建议使用驼峰和中文作为数据表字段命名。
编码建议
-
每个类(不含注释)代码应在200行以内,每个方法(不含注释)代码应在20行以内。
-
控制器层(controller)中,尽量不出现 if else switch 等流程分支语句。
-
业务逻辑尽量封装在逻辑层(logic)中,供控制器调用。
-
数据模型层(model)尽量在逻辑层 logic 中使用,尽量不要再控制器中直接使用model。
-
数据验证尽量写在验证层(validate)中,供逻辑层调用,尽量不要在控制器中进行数据验证。
-
支付|短信 等尽量封装为服务便于后续扩展,图标选择|省市县联动 等尽量封装为插件便于后续复用。
-
API接口尽量根据APP界面实现组合接口,减少APP接口请求。
-
其他文档中遗漏项,尽量参考OneBase编码与命名。
颜·直聘 版权所有 © 2024 鲁ICP备09015312号-14
基本
文件
流程
错误
SQL
调试
- 请求信息 : 2024-12-05 15:00:23 HTTP/1.1 GET : yanzhipin.com/index/details/id/25/cid/7.html
- 运行时间 : 0.018485s [ 吞吐率:54.10req/s ] 内存消耗:1,062.33kb 文件加载:69
- 查询信息 : 8 queries 0 writes
- 缓存信息 : 0 reads,0 writes
- 配置加载 : 93
- /www/wwwroot/yanzhipin.com/public/index.php ( 0.79 KB )
- /www/wwwroot/yanzhipin.com/public/public.php ( 1.08 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/start.php ( 0.73 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/base.php ( 2.66 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Loader.php ( 19.47 KB )
- /www/wwwroot/yanzhipin.com/vendor/composer/autoload_namespaces.php ( 0.21 KB )
- /www/wwwroot/yanzhipin.com/vendor/composer/autoload_psr4.php ( 0.84 KB )
- /www/wwwroot/yanzhipin.com/vendor/composer/autoload_classmap.php ( 0.14 KB )
- /www/wwwroot/yanzhipin.com/vendor/composer/autoload_files.php ( 0.42 KB )
- /www/wwwroot/yanzhipin.com/vendor/qiniu/php-sdk/src/Qiniu/functions.php ( 7.10 KB )
- /www/wwwroot/yanzhipin.com/vendor/qiniu/php-sdk/src/Qiniu/Config.php ( 0.70 KB )
- /www/wwwroot/yanzhipin.com/vendor/topthink/think-captcha/src/helper.php ( 1.59 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Route.php ( 59.82 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Config.php ( 6.03 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Validate.php ( 40.27 KB )
- /www/wwwroot/yanzhipin.com/vendor/topthink/think-queue/src/config.php ( 0.77 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Console.php ( 21.22 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Error.php ( 3.59 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/convention.php ( 10.31 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/App.php ( 21.04 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Request.php ( 50.94 KB )
- /www/wwwroot/yanzhipin.com/app/config.php ( 11.07 KB )
- /www/wwwroot/yanzhipin.com/app/database.php ( 1.46 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Hook.php ( 4.76 KB )
- /www/wwwroot/yanzhipin.com/app/tags.php ( 1.16 KB )
- /www/wwwroot/yanzhipin.com/app/common/behavior/InitBase.php ( 8.17 KB )
- /www/wwwroot/yanzhipin.com/app/common.php ( 16.83 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Env.php ( 1.25 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/helper.php ( 17.86 KB )
- /www/wwwroot/yanzhipin.com/app/function.php ( 0.78 KB )
- /www/wwwroot/yanzhipin.com/app/extend.php ( 10.82 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Debug.php ( 7.06 KB )
- /www/wwwroot/yanzhipin.com/app/common/model/Config.php ( 0.78 KB )
- /www/wwwroot/yanzhipin.com/app/common/model/ModelBase.php ( 12.18 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Model.php ( 66.83 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Db.php ( 6.54 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Log.php ( 5.84 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/db/connector/Mysql.php ( 3.94 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/db/Connection.php ( 29.97 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/db/Query.php ( 89.54 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/db/builder/Mysql.php ( 2.16 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/db/Builder.php ( 30.47 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Cache.php ( 6.17 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/cache/driver/File.php ( 6.98 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/cache/Driver.php ( 5.52 KB )
- /www/wwwroot/yanzhipin.com/app/common/behavior/InitHook.php ( 1.25 KB )
- /www/wwwroot/yanzhipin.com/app/common/model/Hook.php ( 0.77 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Lang.php ( 6.95 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/lang/zh-cn.php ( 3.85 KB )
- /www/wwwroot/yanzhipin.com/app/route.php ( 0.91 KB )
- /www/wwwroot/yanzhipin.com/app/index/config.php ( 0.96 KB )
- /www/wwwroot/yanzhipin.com/app/index/common.php ( 0.68 KB )
- /www/wwwroot/yanzhipin.com/app/index/controller/Index.php ( 1.75 KB )
- /www/wwwroot/yanzhipin.com/app/index/controller/IndexBase.php ( 1.10 KB )
- /www/wwwroot/yanzhipin.com/app/common/controller/ControllerBase.php ( 4.75 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Controller.php ( 6.20 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/traits/controller/Jump.php ( 4.97 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/View.php ( 6.86 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/view/driver/Think.php ( 5.61 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Template.php ( 46.46 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/template/driver/File.php ( 2.24 KB )
- /www/wwwroot/yanzhipin.com/app/common/logic/Article.php ( 5.32 KB )
- /www/wwwroot/yanzhipin.com/app/common/logic/LogicBase.php ( 0.83 KB )
- /www/wwwroot/yanzhipin.com/app/common/model/Article.php ( 0.78 KB )
- /www/wwwroot/yanzhipin.com/app/common/model/ArticleCategory.php ( 0.79 KB )
- /www/wwwroot/yanzhipin.com/runtime/temp/61094331b17330cba73590ddd12f9422.php ( 3.95 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Url.php ( 12.97 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/Response.php ( 8.64 KB )
- /www/wwwroot/yanzhipin.com/thinkphp/library/think/debug/Html.php ( 4.27 KB )
- [ DB ] INIT mysql
- [ CACHE ] INIT File
- [ BEHAVIOR ] Run app\common\behavior\InitBase @app_init [ RunTime:0.004857s ]
- [ BEHAVIOR ] Run app\common\behavior\InitHook @app_init [ RunTime:0.001785s ]
- [ LANG ] /www/wwwroot/yanzhipin.com/thinkphp/lang/zh-cn.php
- [ BIND ] 'index'
- [ ROUTE ] array (
'type' => 'module',
'module' =>
array (
0 => 'index',
1 => 'index',
2 => 'details',
),
)
- [ HEADER ] array (
'user-agent' => 'CCBot/2.0 (https://commoncrawl.org/faq/)',
'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'accept-language' => 'en-US,en;q=0.5',
'accept-encoding' => 'br,gzip',
'host' => 'yanzhipin.com',
'connection' => 'Keep-Alive',
'content-type' => '',
'content-length' => '',
)
- [ PARAM ] array (
'id' => '25',
'cid' => '7',
)
- [ RUN ] app\index\controller\Index->details[ /www/wwwroot/yanzhipin.com/app/index/controller/Index.php ]
- [ CACHE ] INIT File
- [ VIEW ] /www/wwwroot/yanzhipin.com/public/../app/index/view/index/details.html [ array (
0 => 'loading_icon',
1 => 'pjax_mode',
2 => 'static_root',
3 => 'article_info',
4 => 'category_list',
) ]
- [ DB ] CONNECT:[ UseTime:0.000337s ] mysql:dbname=yanzhipin_home;host=127.0.0.1;port=3306;charset=utf8
- [ SQL ] SHOW COLUMNS FROM `ob_config` [ RunTime:0.000628s ]
- [ SQL ] SELECT * FROM `ob_config` [ RunTime:0.000294s ]
- [ EXPLAIN : array (
'id' => 1,
'select_type' => 'SIMPLE',
'table' => 'ob_config',
'partitions' => NULL,
'type' => 'ALL',
'possible_keys' => NULL,
'key' => NULL,
'key_len' => NULL,
'ref' => NULL,
'rows' => 25,
'filtered' => 100,
'extra' => NULL,
) ]
- [ SQL ] SHOW COLUMNS FROM `ob_hook` [ RunTime:0.000410s ]
- [ SQL ] SELECT `id`,`name`,`addon_list` FROM `ob_hook` [ RunTime:0.000210s ]
- [ EXPLAIN : array (
'id' => 1,
'select_type' => 'SIMPLE',
'table' => 'ob_hook',
'partitions' => NULL,
'type' => 'ALL',
'possible_keys' => NULL,
'key' => NULL,
'key_len' => NULL,
'ref' => NULL,
'rows' => 3,
'filtered' => 100,
'extra' => NULL,
) ]
- [ SQL ] SHOW COLUMNS FROM `ob_article` [ RunTime:0.000430s ]
- [ SQL ] SELECT `a`.*,`m`.`nickname`,c.name as category_name FROM `ob_article` `a` INNER JOIN `ob_member` `m` ON `a`.`member_id`=`m`.`id` INNER JOIN `ob_article_category` `c` ON `a`.`category_id`=`c`.`id` WHERE `a`.`id` = '25' AND `a`.`status` <> -1 LIMIT 1 [ RunTime:0.000459s ]
- [ EXPLAIN : array (
'id' => 1,
'select_type' => 'SIMPLE',
'table' => 'a',
'partitions' => NULL,
'type' => 'const',
'possible_keys' => 'PRIMARY',
'key' => 'PRIMARY',
'key_len' => '4',
'ref' => 'const',
'rows' => 1,
'filtered' => 100,
'extra' => NULL,
) ]
- [ SQL ] SHOW COLUMNS FROM `ob_article_category` [ RunTime:0.000360s ]
- [ SQL ] SELECT `id`,`name`,`describe`,`create_time`,`update_time`,`status`,`icon` FROM `ob_article_category` WHERE `status` <> -1 ORDER BY create_time asc [ RunTime:0.000207s ]
- [ EXPLAIN : array (
'id' => 1,
'select_type' => 'SIMPLE',
'table' => 'ob_article_category',
'partitions' => NULL,
'type' => 'ALL',
'possible_keys' => NULL,
'key' => NULL,
'key_len' => NULL,
'ref' => NULL,
'rows' => 2,
'filtered' => 50,
'extra' => 'Using where; Using filesort',
) ]
0.021480s