PHP relative path solution

Source: Internet
Author: User
The solution to the relative path in PHP is require in PHP. when I include a file, most of the files I use are relative paths. Only a global. PHP file is included before the file is included. The content of this file is: & lt ;? Phpchdir (dirname (_ FILE __));? & Gt; solutions to relative paths in PHP
In PHP, When require and include a file, most of the files I use are relative paths. Only a global. PHP file is included before the file is included. The content of this file is:
 

To switch the current directory to the path of global. php.
Place global. php in the root directory, and all the files contained after this will be based on the root directory.

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.