Created
April 28, 2017 09:49
-
-
Save indrakaw/cbf31d45d0cf68173dc5a1223f6e7e6c to your computer and use it in GitHub Desktop.
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
<h1>Put this file anywhere.</h1> | |
<pre>Print server Variable: | |
<?php print_r($_SERVER); ?></pre> | |
<pre>Print base dir of this file: | |
<?php | |
$protocol = 'http://'; | |
$host = $_SERVER['HTTP_HOST']; | |
$file = $_SERVER['SCRIPT_NAME']; | |
// $baseDir = $protocol.$host.str_replace(basename($file), "", $file); | |
$baseDir = str_replace(basename($file), "", $file); | |
echo $baseDir; | |
// PS: It only work via webserver | |
?></pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment