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


PHP PhingFile::getPrefixLength方法代碼示例

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


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

示例1: resolveFile

 function resolveFile(PhingFile $f)
 {
     $path = $f->getPath();
     $pl = (int) $f->getPrefixLength();
     if ($pl === 2 && $path[0] === $this->slash) {
         return path;
         // UNC
     }
     if ($pl === 3) {
         return $path;
         // Absolute local
     }
     if ($pl === 0) {
         return (string) ($this->_getUserPath() . $this->slashify($path));
         //Completely relative
     }
     if ($pl === 1) {
         // Drive-relative
         $up = (string) $this->_getUserPath();
         $ud = (string) $this->_getDrive($up);
         if ($ud !== null) {
             return (string) $ud . $path;
         }
         return (string) $up . $path;
         //User dir is a UNC path
     }
     if ($pl === 2) {
         // Directory-relative
         $up = (string) $this->_getUserPath();
         $ud = (string) $this->_getDrive($up);
         if ($ud !== null && StringHelper::startsWith($ud, $path)) {
             return (string) ($up . $this->slashify(substr($path, 2)));
         }
         $drive = (string) $path[0];
         $dir = (string) $this->_getDriveDirectory($drive);
         $np = (string) "";
         if ($dir !== null) {
             /* When resolving a directory-relative path that refers to a
                drive other than the current drive, insist that the caller
                have read permission on the result */
             $p = (string) $drive . (':' . $dir . $this->slashify(substr($path, 2)));
             if (!$this->checkAccess($p, false)) {
                 // FIXME
                 // throw security error
                 die("Can't resolve path {$p}");
             }
             return $p;
         }
         return (string) $drive . ':' . $this->slashify(substr($path, 2));
         //fake it
     }
     throw new Exception("Unresolvable path: " . $path);
 }
開發者ID:jonphipps,項目名稱:Metadata-Registry,代碼行數:53,代碼來源:Win32FileSystem.php

示例2: isAbsolute

 function isAbsolute(PhingFile $f)
 {
     return $f->getPrefixLength() !== 0;
 }
開發者ID:halfer,項目名稱:Meshing,代碼行數:4,代碼來源:UnixFileSystem.php


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