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


PHP Dir::newRandomSubdir方法代碼示例

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


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

示例1: getProtectedStorage

 /**
  * 
  * Returns the verified storage folder. If it does not exists, it is created.
  * 
  * @return \Mbcraft\Piol\Dir the directory, as a \Mbcraft\Piol\Dir instance, pointing to the verified storage.
  * @throws \Mbcraft\Piol\IOException if the storage root does not exists or is not valid.
  * 
  * @api
  */
 public static function getProtectedStorage()
 {
     $protected_storage_dir = new Dir(self::$storage_root);
     if (!$protected_storage_dir->exists()) {
         throw new IOException("The storage folder does not exist : " . self::$storage_root);
     }
     if (!$protected_storage_dir->isWritable()) {
         throw new IOException("The storage folder is not readable and writable : " . self::$storage_root);
     }
     $results = $protected_storage_dir->listElements();
     if (count($results[0]) == 0 && count($results[1]) <= 1) {
         if ($protected_storage_dir->isEmpty()) {
             $protected_storage_dir->newRandomSubdir();
         }
         return $protected_storage_dir->getUniqueSubdir();
     } else {
         throw new IOException("The storage root folder is invalid : it must contain at most just one folder.");
     }
 }
開發者ID:mbcraft,項目名稱:piol,代碼行數:28,代碼來源:StorageFactory.php

示例2: get_verified_storage

 private static function get_verified_storage()
 {
     $protected_storage_dir = new Dir(self::$storage_root);
     if (!$protected_storage_dir->exists()) {
         throw new IOException("La cartella dello storage non esiste : " . self::$storage_root);
     }
     if (count($protected_storage_dir->listFiles()) > 1) {
         throw new IOException("Lo storage non è valido.");
     }
     if ($protected_storage_dir->isEmpty()) {
         $protected_storage_dir->newRandomSubdir();
     }
     return $protected_storage_dir->getSingleSubdir();
 }
開發者ID:mbcraft,項目名稱:frozen,代碼行數:14,代碼來源:Storage.class.php


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