> For the complete documentation index, see [llms.txt](https://phper.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phper.shujuwajue.com/php-gao-ji-te-xing/ming-ming-kong-jian.md).

# 命名空间(Namespaces)

**命名空间与目录**

对于文件来说，目录就扮演了命名空间的角色

**支持**

PHP 5.3.0 开始

**影响**

类，函数和常量

**定义**

* 通过关键字namespace来声明。
* 所有代码之前（只允许declare()语句）
* 允许指定层次化的命名空间的名称
* 必须使用反斜杠 “ \”
* 也可以在同一个文件中定义多个命名空间 &#x20;
