How to use "root" namespace of php?

namespaces, php

Solution

What can I do to make this work ?

Use a leading backslash to indicate the global namespace:

namespace abc;

class AbcException extends \Exception {
// blah blah
}

Useful documents are appreciated.

There's an entire page devoted to this in the PHP manual!

Problem

I have an Exception class: ``` namespace abc; class AbcException extends Exception { // blah blah } ``` It produces this error: ``` Class 'abc\Exception' not found ... ``` Questions: What can I do to make this work ? Useful documents are appreciated. Thanks for reading my question

Original source

Related problems