Include File. does the relative path of the class or function instantiate the page or file page? -Php Tutorial

Source: Internet
Author: User
Include File. does the relative path of the class or function instantiate the page or file page? A. php: include "B. class. php ";

Assume that the member methods of B. class. php have relative paths;
For example,./1.php _ FILE;

Are these relative paths relative to the source file or a. php;

I tested it with _ FILE _ and./1.php. it turned out to be a mess of two effects,

I would like to ask; I 'd better explain the principle in depth;


Reply to discussion (solution)

If you include or require other files in index. php! The path in any other file is the path of index. php!

It cannot be absolute!
_ FILE _ is the location of the current FILE in the FILE system and is an absolute path. Not discussed in relative paths
./1.php is a relative path, but the example you give cannot describe the problem
If a. php: include "B/B. class. php ";
So: this./1.php is relative to a. php, but./1.php does not exist and B/1.php exists, it is B/1.php.
Because B/1.php is different from B/B. php./1.php
This is a query order problem.

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.