当前位置: 首页>>代码示例>>PHP>>正文


PHP Tool::absolutePath方法代码示例

本文整理汇总了PHP中Tool::absolutePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::absolutePath方法的具体用法?PHP Tool::absolutePath怎么用?PHP Tool::absolutePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tool的用法示例。


在下文中一共展示了Tool::absolutePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: userFileLocation

 static function userFileLocation($file, $defaultLocation = '.')
 {
     if (substr($file, 0, 1) != '/') {
         $file = $_ENV['projectFolder'] . $defaultLocation . '/' . $file;
     }
     //since file base ensured (not purely relative), can run through absolutePath function
     return Tool::absolutePath($file);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:8,代码来源:Config.php

示例2: getAbsoluteUrl

 static function getAbsoluteUrl($url, $relativeTo = null)
 {
     list($uPath, $query) = explode('?', $url);
     preg_match('@(^.*?://.*?)(/.*$|$)@', $uPath, $match);
     if (!$match) {
         //url is relative, use relativeTo as base
         list($rPath) = explode('?', $relativeTo);
         preg_match('@(^.*?://.*?)(/.*$|$)@', $rPath, $match);
         $pathParts = explode('/', $match[2]);
         if ($uPath) {
             if ($uPath[0] == '/') {
                 //relative to base of site
                 $base = $pathParts[0];
                 $pathParts = explode('/', $base . $uPath);
             } else {
                 //relative to directory, so clear page part.   ie url = "view.php?m=bob"
                 array_pop($pathParts);
                 $pathParts = implode('/', $pathParts) . '/' . $uPath;
                 $pathParts = explode('/', $pathParts);
             }
         }
     } else {
         $pathParts = explode('/', $match[2]);
     }
     $path = Tool::absolutePath($pathParts);
     $url = $match[1] . $path;
     if ($query) {
         $url .= '?' . $query;
     }
     return $url;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:31,代码来源:Http.php

示例3: getAbsolute

 static function getAbsolute($basePath, $relativePath, $relativity = null)
 {
     if ($basePath[0] != '/') {
         $basePath = '/' . str_replace('_', '/', $basePath) . '/';
     }
     if (!$relativity) {
         if (preg_match('@(^_+)(.*)@', $relativePath, $match)) {
             $relativePath = $match[2];
             $relativity = $match[1];
         }
     }
     $relativePath = $basePath . str_replace('_', '../', $relativity) . $relativePath;
     //ensure path has ending "/"
     if (substr($relativePath, -1) != '/') {
         $relativePath .= '/';
     }
     $absoluteTable = str_replace('/', '_', substr(Tool::absolutePath($relativePath), 1, -1));
     return $absoluteTable;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:19,代码来源:DbModel.php

示例4: checkPath

 function checkPath($fileName, $path, $options, &$excludePaths, $move = 0)
 {
     if (isset($options['stopMove']) && $options['stopMove'] <= $move) {
         return;
     }
     $path = Tool::absolutePath($path);
     if (!$path) {
         return;
     } elseif ($excludePaths[$path]) {
         return;
     } elseif (isset($options['stopPaths']) && in_array($path, $options['stopPaths'])) {
         return;
     } elseif (isset($options['stopFolders']) && in_array(dirname($path), $options['stopFolders'])) {
         return;
     }
     $excludePaths[$path] = true;
     $dirs = array();
     if (is_dir($path)) {
         foreach (scandir($path) as $v) {
             if ($v != '.' && $v != '..') {
                 if (is_dir($path . $v)) {
                     $dirs[] = $path . $v . '/';
                 } else {
                     if ($v == $fileName) {
                         $filePath = $path . $fileName;
                         if (!$excludePaths[$filePath]) {
                             $excludePaths[$filePath] = true;
                             return $filePath;
                         }
                     }
                 }
             }
         }
     }
     if ($options['moveDown']) {
         foreach ($dirs as $path) {
             if ($path = $this->checkPath($fileName, $path, $options, $excludePaths, $move + 1)) {
                 return $path;
             }
         }
     } elseif ($options['moveUp']) {
         if ($path = $this->checkPath($fileName, $path . '../', $options, $excludePaths, $move + 1)) {
             return $path;
         }
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:46,代码来源:Autoload.php


注:本文中的Tool::absolutePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。