Question about automatic namespace loading

Source: Internet
Author: User
Running environment description: foo. php (file2) is referenced in the index. php (file1) file. if you declare the namespacetestindex in index. php, an error is returned.

Running environment description:
Reference foo. php (file2) in the index. php (file1) file)
Problem:
If you declare the namespace testindex in index. php, an error is returned.

Reply content:

Running environment description:
Reference foo. php (file2) in the index. php (file1) file)
Problem:
If you declare the namespace testindex in index. php, an error is returned.

Because you add a namespace to the function_ Autoload ()It is also used in this namespace, that is, calling this function becomes\ Test \ index \__ autoload ()Php cannot be found._ Autoload ()This function cannot complete the automatic loading process.

One is the result of the annotated namespace, and the other is not.
Why is this happening?
//------------------------------------------------------------

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.