PHP PSR-0 语言规范翻译
2014-06-12 11:53
696 查看
摘自:https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
A fully-qualified namespace and class must have the followingstructure
Each namespace must have a top-level namespace ("Vendor Name").
Each namespace can have as many sub-namespaces as it wishes.
Each namespace separator is converted to a
Each
The fully-qualified namespace and class is suffixed with
Alphabetic characters in vendor names, namespaces, and class names maybe of any combination of lower case and upper case.
大致翻译:
命名空间与类的结构为:\供应商\命名空间\类名。
每个命名空间必须有顶级(供应商)
每个命名空间可以有多个子命名空间。
每个命名空间分割可被转化“/”(目录分割符),当从文件系统中加载的时候。
类名中的_下划线可被转化成“/”(目录分割符),这个符号没有特殊的意思。
类与命名空间后缀以“.php”结尾,当从文件系统中加载的时候。
\供应商\命名空间\类名的字符随便是小写或大写。
Underscores in Namespaces and Class
A fully-qualified namespace and class must have the followingstructure
\<Vendor Name>\(<Namespace>\)*<Class Name>
Each namespace must have a top-level namespace ("Vendor Name").
Each namespace can have as many sub-namespaces as it wishes.
Each namespace separator is converted to a
DIRECTORY_SEPARATORwhenloading from the file system.
Each
_character in the CLASS NAME is converted to a
DIRECTORY_SEPARATOR. The
_character has no special meaning in thenamespace.
The fully-qualified namespace and class is suffixed with
.phpwhenloading from the file system.
Alphabetic characters in vendor names, namespaces, and class names maybe of any combination of lower case and upper case.
大致翻译:
命名空间与类的结构为:\供应商\命名空间\类名。
每个命名空间必须有顶级(供应商)
每个命名空间可以有多个子命名空间。
每个命名空间分割可被转化“/”(目录分割符),当从文件系统中加载的时候。
类名中的_下划线可被转化成“/”(目录分割符),这个符号没有特殊的意思。
类与命名空间后缀以“.php”结尾,当从文件系统中加载的时候。
\供应商\命名空间\类名的字符随便是小写或大写。
Examples
\Doctrine\Common\IsolatedClassLoader=>
/path/to/project/lib/vendor/Doctrine/Common/IsolatedClassLoader.php
\Symfony\Core\Request=>
/path/to/project/lib/vendor/Symfony/Core/Request.php
\Zend\Acl=>
/path/to/project/lib/vendor/Zend/Acl.php
\Zend\Mail\Message=>
/path/to/project/lib/vendor/Zend/Mail/Message.php
Underscores in Namespaces and Class
Names
\namespace\package\Class_Name=>
/path/to/project/lib/vendor/namespace/package/Class/Name.php
\namespace\package_name\Class_Name=>
/path/to/project/lib/vendor/namespace/package_name/Class/Name.php
相关文章推荐
- 我也学php:编码规范/翻译自PSR
- PSR-4翻译,PHP Autoloader 规范
- PSR-4翻译,PHP Autoloader 规范
- php面向对象--psr-0规范
- PHP PSR-4与PSR-0规范
- PSR-4——新鲜出炉的PHP规范
- PHP的PSR规范中文版
- PHP的PSR规范中文版
- googleAIP翻译PHP系统的语言配置
- PSR-PHP开发规范(本文版权归作者:luluyrt@163.com)
- CLR_via_C#.3rd 翻译[1.8 通用语言规范]
- PHP中PSR-[0-4]规范
- PHP编码规范之PSR-2
- [翻译] C# 3.0语言规范
- PHP-FIG 定义的 PSR-3 日志接口规范
- PHP的PSR系列规范都有啥内容
- js通过googleAIP翻译PHP系统的语言配置的实现代码
- [翻译] C# 3.0语言规范
- PHP语言终于有了正式的规范
- PHP编码规范之PSR-1