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


PHP FileSystem::createDirectory方法代码示例

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


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

示例1: mkdir

 /**
  * Create a directory
  */
 public function mkdir($path, $mode, $options)
 {
     if (!$this->initPath($path)) {
         return FALSE;
     }
     $recursive = $options & STREAM_MKDIR_RECURSIVE;
     $dirs = explode('/', $this->getFileName());
     $next = '';
     $dirname = '';
     $created = FALSE;
     do {
         if (!$next && $dirname) {
             continue;
         }
         $dirname .= $dirname === '/' ? $next : '/' . $next;
         if ($recursive || $dirname === '/') {
             $created = $this->fileSystem->createDirectory($dirname);
         }
         $type = $this->fileSystem->getFileType($dirname);
         if ($type !== FileSystem::FILE_TYPE_DIRECTORY) {
             if ($type !== FALSE) {
                 return FALSE;
             }
             if (!empty($dirs)) {
                 return FALSE;
             }
             $created = FALSE;
             break;
         }
     } while (($next = array_shift($dirs)) !== NULL);
     if (!$created) {
         $created = $this->fileSystem->createDirectory($dirname);
     }
     return !!$created;
 }
开发者ID:sallyx,项目名称:redis-php-stream-wrapper,代码行数:38,代码来源:Wrapper.php

示例2: testCreateDirectoryCreatesDirectories

 public function testCreateDirectoryCreatesDirectories()
 {
     $fs = new FileSystem();
     $directory = $fs->createDirectory('/dir/dir', true);
     $this->assertInstanceOf('\\VirtualFileSystem\\Structure\\Directory', $directory);
     $this->assertEquals('/dir/dir', $directory->path());
 }
开发者ID:mathroc,项目名称:php-vfs,代码行数:7,代码来源:VirtualFilesystemTest.php

示例3: checkFolder

 public function checkFolder()
 {
     $path = $this->getFolderPath();
     if (!file_exists($path) && !FileSystem::createDirectory($path)) {
         throw new RuntimeException('Folder to store images for ' . get_class($this) . ' doesnt exist');
     }
     return true;
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:8,代码来源:OuterLinkImage.php

示例4: getSavePath

 public function getSavePath()
 {
     $imagePath = Yii::app()->params['blog']['imagePath'];
     if (!file_exists($imagePath)) {
         FileSystem::createDirectory($imagePath);
     }
     return $imagePath;
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:8,代码来源:BlogImage.php

示例5: setDefaultLogName

 public static function setDefaultLogName($addName = '', $logKey = 'default', $runFileName = '')
 {
     if (empty($addName)) {
         $fileName = DIR_LOG . Format::date() . $addName . '.log';
     } else {
         $fileName = DIR_LOG . $addName . '.log';
     }
     FileSystem::createDirectory(DIR_LOG);
     self::$_fileNames[$logKey] = $fileName;
     self::$_runFileName = $runFileName;
 }
开发者ID:binocchi,项目名称:my_snippet,代码行数:11,代码来源:Logger.php

示例6: setUp

 public function setUp()
 {
     $pathToImages = $this->getFolderPath();
     FileSystem::createDirectory($pathToImages);
     if (file_exists($pathToImages . '/' . self::TEST_IMAGE_SMALL_NAME)) {
         $this->assertTrue(unlink($pathToImages . '/' . self::TEST_IMAGE_SMALL_NAME));
     }
     if (file_exists($pathToImages . '/' . self::TEST_IMAGE_MEDIUM_NAME)) {
         $this->assertTrue(unlink($pathToImages . '/' . self::TEST_IMAGE_MEDIUM_NAME));
     }
     $testImgName = self::TEST_IMAGE_NAME;
     $source = Yii::getPathOfAlias('application.tests.data') . '/' . $testImgName;
     $dest = $pathToImages . '/' . $testImgName;
     $this->assertTrue(copy($source, $dest), 'cannot copy ' . $source . ' to ' . $dest);
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:15,代码来源:MainViewImageTest.php

示例7: createDirectory

 /**
  * @param $path
  * @return bool
  * @deprecated since r1234 moved to FileSystem
  * @see        FileSystem
  */
 public static function createDirectory($path)
 {
     return FileSystem::createDirectory($path);
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:10,代码来源:Util.php


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