PHP-----TP Framework----namespaces

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.