What is the difference between include_once "/include/a. php" and include_once "./include/a. php? Solution

Source: Internet
Author: User
Include_once & quot;./include/a. php & quot; and include_once & quot; ../include/a. php & quot; what is the difference ??? Include_once & quot;./include/a include_once "./include/a. php" and include_once "../include/a. php" What is the difference ???
What is the difference between include_once "./include/a. php" and include_once ".../include/a. php ???

------ Solution --------------------
Is it a tongue twister?
Depending on the location of the referenced file, different file paths are introduced. different paths have different natural functions.
One is/include/a. php under the current directory.
One is/include/a. php under the root directory.

/Include. php
/Include/a. php
/Include/a. php

If the currently referenced file is in include. php under include/include
Include_once "./include/a. php"
Then it will reference include/a. php

Include_once "../include/a. php"
It will reference include/a. php

/Include. php
/Include/a. php
/Include/a. php
If the reference is in the root directory include. php
The above two references will point to the same file./include/a. php

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.