Last active
September 29, 2016 18:30
-
-
Save micah1701/4cf2ad34e3cf6134b796865fa3b9c657 to your computer and use it in GitHub Desktop.
Determine the server and web directory of the current file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* set the server directory that this application is stored in. | |
* if applicaiton is in the root directory, set to "/" | |
*/ | |
$_app_server_path = rtrim(str_replace('\\', '/', dirname(__FILE__)),"/")."/"; // eg: "/home/ubuntu/workspace/my-website/" | |
$web_app_path = str_replace(rtrim($_SERVER['DOCUMENT_ROOT'],"/"),'',$_app_server_path); // eg: "/my-website/" or just "/" if in root | |
define('_app_path',$web_app_path); | |
define('_app_server_path',$_app_server_path); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment