1
namespace externalServices\Service;
class FirstService  extends Exception {



}

现在 Exception 没有定义。我知道我可以使用 \Exception AS Exception; 但是如何将所有本机类导入命名空间

4

1 回答 1

4

做不到。

解决方案是手动导入...

use Exception; //Notice leading \ is not needed

或者使用绝对路径...

class FirstService extends \Exception {
于 2013-08-08T20:49:41.923 回答