将所有预定义的PHP类导入我的命名空间

时间:2013-08-08 20:39:17

标签: php oop

namespace externalServices\Service;
class FirstService  extends Exception {



}

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

1 个答案:

答案 0 :(得分:4)

无法完成。

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

use Exception; //Notice leading \ is not needed

或使用绝对路径......

class FirstService extends \Exception {