首頁 >php教程 >PHP源码 >php 获取系统当前路径与检查php配置参数

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

WBOY
WBOY原創
2016-06-08 17:29:111027瀏覽
<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;
  }
 }

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