PHP 5.3 In namespace is actually a good thing, you can simplify the programming, the following describes the three categories in the code
Methods for accessing classes in namespace
1 referencing namespace and classes
Suppose the namespace program is namespaced-class.php
namespace Christmas\daysof; Class partridgeinapeartree{}
Reference method:
Include ' namespaced-class.php '; $bird 1 = new Christmas\daysof\partridgeinapeartree (); Var_dump ($bird 1);
At this time, new has introduced the complete namespace and the following classes.
2 Partial references
Include ' namespaced-class.php '; use christmas\daysof; $bird 2 = new Daysof\partridgeinapeartree (); Var_dump ($bird 2);
With the use specified in the namespace, it is only necessary to refer to the last part of the namespace when using Daysof.
3 The simplest
Include ' namespaced-class.php '; use Christmas\daysof\partridgeinapeartree as Bird; $bird 3 = new Bird (); Var_dump ($bird 3);
In this case, the specified class under the namespace is replaced by a custom name, which is very convenient.
Related recommendations:
Using the PHP page static steps