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

WBOY
Release: 2016-06-13 10:41:14
Original
704 people have browsed it

得到服务器绝对路径的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 "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template