Created
June 4, 2014 08:33
-
-
Save withgod/fb915cd209849113f754 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
<?php | |
var_dump($_SERVER); | |
#環境によって微妙に違うから好きなの選ぶ為にvar_dump | |
#REQUEST_URI | |
#SCRIPT_NAME | |
#PHP_SELF | |
#SCRIPT_FILENAME | |
if (preg_match('/index.php/', $_SERVER['SCRIPT_NAME'])) { | |
include_once('/path/to/hoge.php'); | |
} | |
#か | |
if (strpos($_SERVER['SCRIPT_NAME'], 'index.php') !== false ) { # 0番目が来たら誤検知するので厳密比較演算子使う | |
include_once('/path/to/hoge.php'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment