【发布时间】:2014-03-24 10:31:10
【问题描述】:
正如php reference中所说的
命名空间是使用命名空间关键字声明的。一个文件包含 命名空间必须在文件顶部声明命名空间之前 任何其他代码 - 除了一个例外:declare 关键字。
但我们在参考文献中还有以下代码 sn-p:
<?php
namespace MyProject;
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
namespace AnotherProject; //This namespace declaration doesn't located at the top of the file. It's unclear.
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
?>
【问题讨论】:
标签: php namespaces declaration declare