What does PHP use namespace mean?

Source: Internet
Author: User
Keywords Php
Help documents can not be found, search is also very difficult to understand.
Novice tutorials do not understand.

What does use a\b mean?

I began to understand that:
After using the use \a\b, the definition of class,function will be defined under \a\b, and the experiment is found to be incorrect.

Also understood as:

Afunction () after using use \a\b;
Will call \a\b\afunction (); and found it wrong.

Excuse me, what does this mean?

In addition this site input \ Words, need to enter two \, that is, \ \ escaped.

//1.php
  
   ";    ///echo \a\b\c\value3;    echo \a\b\c\value3;
//2.php
  
   

这个怎么报错呢?我哪里弄错了?

Reply content:

Help documents can not be found, search is also very difficult to understand.
Novice tutorials do not understand.

What does use a\b mean?

I began to understand that:
After using the use \a\b, the definition of class,function will be defined under \a\b, and the experiment is found to be incorrect.

Also understood as:

Afunction () after using use \a\b;
Will call \a\b\afunction (); and found it wrong.

Excuse me, what does this mean?

In addition this site input \ Words, need to enter two \, that is, \ \ escaped.

//1.php
  
    ";    ///echo \a\b\c\value3;    echo \a\b\c\value3;
//2.php
  
    

这个怎么报错呢?我哪里弄错了?

use AB this notation is used in namespaces, where the namespace is in the php5.3 is introduced after the . The
Mesh is for convenience, canonical reference class, php5.3 previously referenced classes are through __autoload to determine whether the class is introduced, if not introduced require (' ***.class.php '); The automatic loading of classes is implemented in this way. The
now has namespaces that make the code look more prescriptive.
For example: a.class.php class file to add a namespace, such as;
namespace app\a;
It is possible to introduce classes in any other file by using the use App\a; method.
The hierarchical directory in another namespace is designed to make it easier for developers to know what directory the file is in, such as:
Define a namespace in /a/b/c/d/e.class.php Namespase a\b\c\d\e;
In other files use a\b\c\d\e; to know clearly which directory it is in.
Append: Landlord code error reasons have a few aspects.
1: The use of namespaces is primarily used in classes
2: Using the use will not include the
proposed landlord to look at the official documents, the use of the method is very comprehensive

Manual it says, "How could it not be found?"
Using namespaces: Aliases/imports

  • 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.