search

说明:这个规范应该是基本的规范了吧。大部分程序员都知道这样的规范,从规范上看应该是使用ZendFramework开发的。

参考一下:

开发原则

1.业务逻辑统一写在数据库的存储过程里,数据查询和组合在程序中完成
2.存储过程统一用专用程序修改,禁止直接在客户端修改
3.存储过程头部必须撰写该操作的业务流程描述
4.数据库对于带小数点数字统一使用 DECIMAL 类型,禁止使用 FLOAT 类型
5.数据库主键统一使用 BIGINT(20) UNSIGNED AUTO INCREMENT
6.所有 CSS/JavaScript 均按各自功能写在独立的文件上
7.所有 JavaScript 均使用 jQuery App 插件形式撰写
8.视图上只使用页面控件输出数据
9.控制器只负责获取数据、设置页面控件或调用模型操作
10.控制器每个业务操作动作只允许调用一个模型的一个方法
11.模型不一定操作数据库,但自身必须定义或保存数据,否则应为助手
12.助手可以为纯静态类或可实例化的对象
13.使用 PHPDoc 标准注释每个对象、方法、函数和变量相关基本信息
14.关键处理或逻辑必须详细说明
15.助手名称必须以 Helper 结尾
16.模型名称不需要加上 Model
17.统一使用 Igou::modx() 代替 global $modx
18.统一使用 Zend_Db_Select 组装 SQL 语句

数据库命名规范

1.数据表主键统一使用 id 作为字段名
2.数据库字段名称单词之间使用 _ 分割,禁止两个单词连写
3.所有爱购网自建数据表加上 igou_ 前缀,方便与 modx 区分
4.数据表统一使用单数形式

代码编写标准

1.变量、方法和函数统一使用驼峰式大小写,首字母小写
2.对象名称使用下横线分隔单词,单词首字母大写
3.常量统一使用单数形式
4.自定义常量统一加上 IGOU_ 前缀
5.纯 PHP 文件结尾不写 ?>
6.源代码文件行尾不留空格(包括空行)
7.非公开方法或属性(变量)名字加 _ 前缀

注意事项 1.外接代码片段使用 [!片段名!] 调用,并非 [[片段名]]
2.外接代码片段可使用 [!控制器::动作!] 形式调用 若无指定控制器则调用 Index 控制器的方法
3.代码片段对应 Action 返回内容时使用 $this->_response->setBody('内容');
4.所有外接代码片段的调用工作由 Plugins 的 SnippetsController 执行
5.全局公用的 View Helper 放在 library/Igou/View/Helper 下
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
11 Best PHP URL Shortener Scripts (Free and Premium)11 Best PHP URL Shortener Scripts (Free and Premium)Mar 03, 2025 am 10:49 AM

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Introduction to the Instagram APIIntroduction to the Instagram APIMar 02, 2025 am 09:32 AM

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, ReactBuild a React App With a Laravel Back End: Part 2, ReactMar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Announcement of 2025 PHP Situation SurveyAnnouncement of 2025 PHP Situation SurveyMar 03, 2025 pm 04:20 PM

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools