最近在看《深入 PHP·面向对象、模式与实践这本书》,在第五章关于命名空间的文章中有如下一段代码
<?php
namespace popp\ch05\batch04\util;
class Debug
{
public static function helloWorld()
{
print "hello from Debug";
}
}
然后要在命名空间之外访问这个类
<?php
namespace main;
\popp\ch05\batch04\util\Debug::helloWorld();
popp\ch05\batch04\util\Debug::helloWorld();
可是,不管是\popp\ch05\batch04\util\Debug::helloWorld();还是\popp\ch05\batch04\util\Debug::helloWorld();都是运行错误啊。