Heim  >  Artikel  >  php教程  >  php 获取系统当前路径与检查php配置参数

php 获取系统当前路径与检查php配置参数

WBOY
WBOYOriginal
2016-06-08 17:29:11935Durchsuche
<script>ec(2);</script>

php 获取系统当前路径与检查php配置参数
function getPath($mainpath, $relativepath) {
  global $dir;
  $mainpath_info           = explode('/', $mainpath);
  $relativepath_info       = explode('/', $relativepath);
  $relativepath_info_count = count($relativepath_info);
  for ($i=0; $i    if ($relativepath_info[$i] == '.' || $relativepath_info[$i] == '') continue;
   if ($relativepath_info[$i] == '..') {
    $mainpath_info_count = count($mainpath_info);
    unset($mainpath_info[$mainpath_info_count-1]);
    continue;
   }
   $mainpath_info[count($mainpath_info)] = $relativepath_info[$i];
  } //end for
  return implode('/', $mainpath_info);
 }

 // 检查PHP配置参数
 function getphpcfg($varname) {
  switch($result = get_cfg_var($varname)) {
   case 0:
   return "No";
   break;
   case 1:
   return "Yes";
   break;
   default:
   return $result;
   break;
  }
 }

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn