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


PHP Folder::path方法代碼示例

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


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

示例1: _zipDir

 private static function _zipDir(Folder $dir, \ZipArchive $zip, $relative_path)
 {
     $items = $dir->ls();
     if (count($items)) {
         foreach ($items as $item) {
             if ($item->isFile()) {
                 $name = $relative_path . $item->name();
                 $name = @iconv('UTF-8', 'CP850//TRANSLIT', $name);
                 \GO::debug("Add file: " . $name);
                 $zip->addFile($dir->path() . '/' . $item->name(), $name);
             } else {
                 self::_zipDir($item, $zip, $relative_path . $item->name() . '/');
             }
         }
     } else {
         \GO::debug("Add empty dir: " . $relative_path);
         if (!$zip->addEmptyDir(rtrim($relative_path, '/'))) {
             throw new \Exception("Could not add emty directory " . $relative_path);
         }
     }
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:21,代碼來源:Zip.php

示例2: moveUploadedFiles

 /**
  *
  * @param array $uploadedFileArray
  * @param Folder  $destinationFolder
  * @param boolean $overwrite If false this function will append a number. eg. Filename (1).jpg
  * @return File[]
  */
 public static function moveUploadedFiles($uploadedFileArray, $destinationFolder, $overwrite = false)
 {
     if (!is_array($uploadedFileArray['tmp_name'])) {
         $uploadedFileArray['tmp_name'] = array($uploadedFileArray['tmp_name']);
         $uploadedFileArray['name'] = array($uploadedFileArray['name']);
     }
     $files = array();
     for ($i = 0; $i < count($uploadedFileArray['tmp_name']); $i++) {
         if (is_uploaded_file($uploadedFileArray['tmp_name'][$i])) {
             $destinationFile = new File($destinationFolder->path() . '/' . $uploadedFileArray['name'][$i]);
             if (!$overwrite) {
                 $destinationFile->appendNumberToNameIfExists();
             }
             if (move_uploaded_file($uploadedFileArray['tmp_name'][$i], $destinationFile->path())) {
                 $destinationFile->setDefaultPermissions();
                 $files[] = $destinationFile;
             }
         }
     }
     return $files;
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:28,代碼來源:File.php

示例3: rss

 public function rss()
 {
     setlocale(LC_ALL, 'en_US');
     $limit = 10;
     $ret = array();
     foreach ($this->folder->subFolders as $s) {
         $path = Folder::path($s);
         $uri = $path . '/last/' . $limit;
         $ret += Ctrl::fetchData($uri);
     }
     krsort($ret);
     return array_splice($ret, 0, $limit);
 }
開發者ID:rezaprima,項目名稱:icms,代碼行數:13,代碼來源:dummycontroller.php

示例4: createLink

 /**
  * Create a symbolic link in this folder
  * 
  * @param Folder $target
  * @param string $linkName optional link name. If omitted the name will be the same as the target folder name
  * @return File
  * @throws Exception
  */
 public function createLink(Folder $target, $linkName = null)
 {
     if (!isset($linkName)) {
         $linkName = $target->name();
     }
     $link = $this->createChild($linkName, true);
     if ($link->exists()) {
         throw new \Exception("Path " . $link->path() . " already exists");
     }
     if (symlink($target->path(), $link->path())) {
         return $link;
     } else {
         throw new \Exception("Failed to create link " . $link->path() . " to " . $target->path());
     }
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:23,代碼來源:Folder.php


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