- This topic has 0 replies, 1 voice, and was last updated 13 years, 9 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Home › Forums › Tech › Web Development › Loading a PHP file without hard-coding the path
This is a simple way to include a PHP file without hard-coding either an absolute file location, or relative to a directory, where the file is loaded from:
<?php
require($_SERVER['DOCUMENT_ROOT'] .
"wp-contentyou-pathyour-file-name.php");
?>
This was tested on Windows IIS. On Unix machines you would need to change back slash to a front slash (‘/’)
© 2017 DomainWebCenter.com. All Rights Reserved. | Disclaimer | Contact the Editor