TP Framework----Namespaces
namespace, what role does it play???
The "1" namespace is a virtual directory, this file may exist anywhere on this computer, but if you want to put this file its namespace is all written in the same folder, the file is equivalent to a virtual directory, the namespace is used to manage the file, Used to manage the program files;
"2" It uses the namespace to load the class automatically, that is, only need use Think\controller; you can load the Controller class into the page;
The role of the "3" namespace: the equivalent of a virtual path, which is equivalent to a virtual directory.
To analyze the TP framework of the namespace what is the law???
The entire TP framework, starting from the think.php folder under the WWW folder, belongs to all the contents of the TP framework, including the programs we write.
This belongs to all of the content in the TP framework, including the programs we write.
The THINK.PHP,TP framework has an initial namespace, which is equivalent to the root of our computer's C and D drives. think.php where is the initial namespace? Locate the Thinkphp folder under the Think.php folder
Find the Library folder under the Thinkphp folder, this TP framework its initial namespace is the location of the Library folder,
This TP framework its initial namespace is the location to the Library folder
In other words, the initial namespace represents the library folder under the Thinkphp folder. All of the initial namespaces for the TP framework, where the initial namespace is used as the initial namespace for the Library folder, is equivalent to defining a directory
PHP-----TP Framework----namespaces