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


PHP Dir::getSingleSubdir方法代碼示例

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


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

示例1: testProps

 function testProps()
 {
     $storage_test_root = "/" . FRAMEWORK_CORE_PATH . "tests/io/storage_dir/";
     Storage::set_storage_root($storage_test_root);
     $test_file = new File("/" . FRAMEWORK_CORE_PATH . "tests/io/file_props_test.php");
     $this->assertFalse($test_file->hasStoredProps(), "Il file ha delle proprieta' con lo storage vuoto!!");
     $storage = $test_file->getStoredProps();
     $storage->add("test", array("hello" => 1, "world" => "good"));
     $this->assertTrue($test_file->hasStoredProps(), "Il file storage delle proprieta' non e' stato creato!!");
     $file_path = $test_file->getPath();
     $sum = md5($file_path);
     $store_subdir = "_" . substr($sum, 0, 1);
     $storage_test_root_dir = new Dir($storage_test_root);
     $real_store_dir = $storage_test_root_dir->getSingleSubdir();
     $all_dirs = $real_store_dir->listFiles();
     $props_file_dir = $all_dirs[0];
     $this->assertEqual($props_file_dir->getName(), $store_subdir, "La directory creata non corrisponde!!");
     $final_stored_path = new File($real_store_dir->getPath() . $props_file_dir->getName() . DS . $sum . ".ini");
     $this->assertTrue($final_stored_path->exists(), "Il file finale delle props non e' stato trovato!!");
     $test_file->deleteStoredProps();
     $this->assertFalse($test_file->hasStoredProps(), "Il file delle proprieta' non e' stato eliminato!!");
     $all_files = $real_store_dir->listFiles();
     foreach ($all_files as $f) {
         $f->delete(true);
     }
     Storage::set_storage_root(Storage::get_default_storage_root());
 }
開發者ID:mbcraft,項目名稱:frozen,代碼行數:27,代碼來源:file_props_test.php

示例2: testGetSingleSubdirFailSingleFile

 function testGetSingleSubdirFailSingleFile()
 {
     $dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/single_subdir/blablablax/");
     try {
         $sub_dir = $dir->getSingleSubdir();
         $this->fail("Il metodo getSingleSubdir non ha lanciato l'eccezione prevista.");
     } catch (Exception $ex) {
     }
 }
開發者ID:mbcraft,項目名稱:frozen,代碼行數:9,代碼來源:plain_dir_test.php

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