In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "what are the PHP development specifications", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the PHP development specifications"?
Source file
Code usage
The file format must be without BOM UTF-8 format
A file declares only one type. For example, class and interface cannot be mixed in a source file.
Indent
Use 4 spaces to indent, IDE can set
Line length
120 characters per line
Keyword
All keywords are lowercase, such as true, false
Naming
The class is called the big hump method, such as UserModel
The class method is called small hump method, such as getUserId ()
Functions are combined with lowercase letters, such as get_cookie ()
Variable names use the small hump method, such as $userId
A constant is defined as a combination of uppercase letters plus _, such as IS_DEBUG
Code comment tag
Annotate classes, methods, and properties in the class file, using @ param @ return @ throwns
@ param comment to write a detailed explanation, such as @ param string $username user name
Service module
Routes are composed of lowercase letters plus _, such as / api/get_user_info
The View layer is responsible for data presentation.
The Controller layer is responsible for input parameter verification, the outermost layer catches exceptions, and calls Logic and View view layers.
The Logic layer is responsible for the specific business logic, calls the Model layer, and returns the processing data
The Model layer is responsible for data table query and association.
Exception classes need to distinguish functions. For example, ParamException indicates parameter error, and UserException indicates custom exception.
For exceptions, you need to classify and define code, and use PHP class constants instead, such as
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.