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


PHP Path::split方法代码示例

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


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

示例1: real

 public static function real($path)
 {
     $path = Path::split($path);
     $newpath = array();
     while (list(, $v) = each($path)) {
         switch ($v) {
             case '.':
                 continue;
             case '..':
                 array_pop($newpath);
                 continue;
             default:
                 $newpath[] = $v;
         }
     }
     return Path::join($newpath);
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:17,代码来源:ns_path.php

示例2: searchFiles

 function searchFiles($path, $name, $content)
 {
     if ($name === '' && $content === '') {
         throw new NameException();
     }
     $parent = $this->rootFolder;
     if ($parent->isProxy) {
         if ($parent->canSearch) {
             return $parent->searchFiles($path, $name, $content);
         }
         return [];
     }
     $splitPaths = Path::split($path);
     $passedFolders = [];
     while ($splitPaths) {
         $folderName = array_shift($splitPaths);
         $passedFolders[] = $folderName;
         $item = $parent->get($folderName);
         if (!$item) {
             throw new FolderNotFoundException(Path::join($passedFolders));
         } else {
             if ($item instanceof File) {
                 throw new NotAFolderException($path);
             } elseif ($item->isProxy) {
                 if ($item->canSearch) {
                     $files = $item->searchFiles(Path::join($splitPaths), $name, $content);
                     foreach ($files as &$file) {
                         $file['path'] = Path::join([$path, $file['path']]);
                     }
                     return $files;
                 }
                 throw new NotAFolderException(Path::join($passedFolders));
             }
         }
         $parent = $item;
     }
     $files = $parent->searchFiles($name, $content);
     foreach ($files as &$file) {
         $file['path'] = Path::join([$path, $file['path']]);
     }
     return $files;
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:42,代码来源:FileSystem.php

示例3: searchFiles

 function searchFiles($path, $name, $content)
 {
     $splitPaths = Path::split($path);
     $this->chdir($splitPaths);
     $files = $this->searchFilesRecursive($name, $content, []);
     foreach ($files as &$file) {
         $file['path'] = Path::join([$path, $file['path']]);
     }
     return $files;
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:10,代码来源:FileSystemProxy.php

示例4: remove

 function remove($path)
 {
     $this->sessionSuspend();
     try {
         $ftp = $this->getConnection();
         $splitPaths = Path::split($path);
         $name = array_pop($splitPaths);
         $this->chdir($ftp, $splitPaths);
         if (ftp_is_dir($ftp, $name)) {
             include_once __DIR__ . '/../fns/ftp_rrmdir.php';
             $ok = ftp_rrmdir($ftp, $name);
             if (!$ok) {
                 throw new ReadWriteException($path);
             }
         } elseif (ftp_is_file($ftp, $name)) {
             $ok = @ftp_delete($ftp, $name);
             if (!$ok) {
                 throw new ReadWriteException($path);
             }
         } else {
             throw new FileNotFoundException($path);
         }
     } catch (Exception $e) {
         $this->sessionResume();
         throw $e;
     }
     $this->sessionResume();
 }
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:28,代码来源:FtpProxy.php

示例5: foreach

            $items = $index['items'];
            if ($items) {
                foreach ($items as $item) {
                    $name = $href = $item['name'];
                    $type = $item['type'];
                    if ($type == 'parent-folder') {
                        $href = '..';
                        $name = '.. Parent Folder';
                    } elseif ($type == 'folder') {
                        $href .= '/';
                        $name .= '/';
                    }
                    $html .= '<div>' . '<a href="' . htmlspecialchars($href) . '">' . htmlspecialchars($name) . '</a>' . '</div>';
                }
            } else {
                $html .= '<div style="color: #474740">Folder is empty.</div>';
            }
            $html .= '</body>' . '</html>';
            echo $html;
        } else {
            $splitPath = Path::split($path);
            $folderName = array_pop($splitPath);
            redirect("{$folderName}/");
        }
    }
} catch (FolderNotFoundException $e) {
    header('HTTP/1.1 404 Not Found');
    echo '<!DOCTYPE html>' . '<html>' . '<head>' . '<title>404 Not Found</title>' . '</head>' . '<body>' . '<h1>404 Not Found</h1>' . '</body>' . '</html>';
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
开发者ID:ufosky-server,项目名称:Gvirila,代码行数:31,代码来源:get-item.php


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