首頁  >  文章  >  後端開發  >  失去服务器绝对路径的PHP代码

失去服务器绝对路径的PHP代码

WBOY
WBOY原創
2016-06-13 13:13:01948瀏覽

得到服务器绝对路径的PHP代码


echo "__FILE__  :

".__FILE__."

";
echo "dirname(__FILE__)  :

".dirname(__FILE__)."

";


echo "\$_SERVER['DOCUMENT_ROOT']:

".$_SERVER['DOCUMENT_ROOT']."

";
echo "\$_SERVER['PHP_SELF'] :

".$_SERVER['PHP_SELF']."

";
echo "dirname(\$_SERVER['PHP_SELF']) : 

" .dirname($_SERVER['PHP_SELF'])."

";
echo "

".$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."

";

echo "realpath('./') :

".realpath('./')."

";


$pathInfo = pathinfo(__FILE__);
echo "pathinfo(__FILE__,PATHINFO_DIRNAME):

".$pathInfo[dirname]."

";
echo "pathinfo(__FILE__,PATHINFO_BASENAME):

".$pathInfo[basename]."

";
echo "pathinfo(__FILE__,PATHINFO_EXTENSION]):

".$pathInfo[extension]."

";

echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn