當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MOXMAN_Util_PathUtils::sitePaths方法代碼示例

本文整理匯總了PHP中MOXMAN_Util_PathUtils::sitePaths方法的典型用法代碼示例。如果您正苦於以下問題:PHP MOXMAN_Util_PathUtils::sitePaths方法的具體用法?PHP MOXMAN_Util_PathUtils::sitePaths怎麽用?PHP MOXMAN_Util_PathUtils::sitePaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MOXMAN_Util_PathUtils的用法示例。


在下文中一共展示了MOXMAN_Util_PathUtils::sitePaths方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getSitePaths

 /**
  * getSitePaths
  *
  * @param string $file   Site absolute path.
  * @param string $script URL path.
  *
  * @return Array With wwwroot and prefix.
  */
 public static function getSitePaths($file = "", $script = "")
 {
     if (self::$sitePaths && !defined('PHPUNIT')) {
         return self::$sitePaths;
     }
     if (!$file && defined("MOXMAN_API_FILE")) {
         $file = MOXMAN_API_FILE;
     }
     $file = $file ? $file : $_SERVER["SCRIPT_FILENAME"];
     $script = $script ? $script : $_SERVER["SCRIPT_NAME"];
     $file = explode("/", self::toUnixPath($file));
     $script = explode("/", self::toUnixPath($script));
     $u = count($file) - 1;
     for ($i = count($script) - 1; $i >= 0; $i--) {
         $val = $file[$u--];
         if ($val != $script[$i]) {
             $u++;
             // To include last chunk
             break;
         }
     }
     $wwwroot = implode("/", array_slice($file, 0, $u + 1));
     $prefix = implode("/", array_slice($script, 0, $i + 1));
     self::$sitePaths = array("wwwroot" => $wwwroot, "prefix" => $prefix);
     return self::$sitePaths;
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:34,代碼來源:PathUtils.php

示例2: getSitePaths

 /**
  * getSitePaths
  *
  * @param string $file Site absolute path /var/www/dir/file
  * @param string $script URL path. /dir/file
  * @return Array With wwwroot and prefix.
  */
 public static function getSitePaths($file = "", $script = "")
 {
     // @codeCoverageIgnoreStart
     if (self::$sitePaths && !defined('PHPUNIT')) {
         return self::$sitePaths;
     }
     // @codeCoverageIgnoreEnd
     // Check if we have a defined MOXMAN_API_FILE this might not be the case
     // if MOXMAN.php is loaded directly we then need to fallback to SCRIPT_FILENAME
     //if (!$file && defined("MOXMAN_API_FILE")) {
     //	$file = MOXMAN_API_FILE;
     //}
     $file = $file ? $file : MOXMAN_ROOT;
     $script = $script ? $script : dirname($_SERVER["SCRIPT_NAME"]);
     $file = explode("/", self::toUnixPath($file));
     $script = explode("/", self::toUnixPath($script));
     $u = count($file) - 1;
     for ($i = count($script) - 1; $i >= 0; $i--) {
         $val = $file[$u--];
         if (strtolower($val) != strtolower($script[$i])) {
             $u++;
             // To include last chunk
             break;
         }
     }
     $wwwroot = implode("/", array_slice($file, 0, $u + 1));
     $prefix = implode("/", array_slice($script, 0, $i + 1));
     self::$sitePaths = array("wwwroot" => $wwwroot, "prefix" => $prefix);
     return self::$sitePaths;
 }
開發者ID:codekanzlei,項目名稱:cake-cktools,代碼行數:37,代碼來源:PathUtils.php


注:本文中的MOXMAN_Util_PathUtils::sitePaths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。