📄 language.namespaces.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Namespaces</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.oop5.references.html">Objects and references</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.definition.html">Namespace definition</a></div> <div class="up"><a href="langref.html">Language Reference</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Namespaces</h1><h2>Table of Contents</h2><ul class="chunklist chunklist_chapter"><li><a href="language.namespaces.definition.html">Namespace definition</a></li><li><a href="language.namespaces.using.html">Using namespaces</a></li><li><a href="language.namespaces.global.html">Global space</a></li><li><a href="language.namespaces.constant.html">__NAMESPACE__</a></li><li><a href="language.namespaces.rules.html">Name resolution rules</a></li></ul> <div id="language.namespaces.rationale" class="sect1"> <h2 class="title">Namespaces overview</h2> <p class="simpara"> Namespaces in PHP are designed to solve scoping problem in large PHP libraries. In PHP, all class definitions are global. Thus, when a library author creates various utility or public API classes for the library, he must be aware of the possibility that other libraries with similar functionality would exist and thus choose unique names so that these libraries could be used together. Usually it is solved by prefixing the class names with an unique string - e.g., database classes would have prefix <b class="classname">My_Library_DB</b>, etc. As the library grows, prefixes add up, leading to the very long names. </p> <p class="simpara"> The namespaces allow the developer to manage naming scopes without using the long names each time the class is referred to, and solve the problem of shared globals space without making code unreadable. </p> <p class="simpara"> Namespaces are available in PHP as of PHP 5.3.0. This section is experimental and subject to changes. </p> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.oop5.references.html">Objects and references</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.definition.html">Namespace definition</a></div> <div class="up"><a href="langref.html">Language Reference</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -