欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-06-09 07:50:39
...
得到服务器绝对路径的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 "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
失去服务器绝对路径的PHP代码

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频