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

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

WBOY
WBOYOriginal
2016-06-08 17:29:11997browse
<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;
  }
 }

Statement:
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