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


PHP FileHelper::createDirectory方法代码示例

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


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

示例1: publishFile

 /**
  * Publishes a file.
  * @param string $src the asset file to be published
  * @return array the path and the URL that the asset is published as.
  * @throws InvalidParamException if the asset to be published does not exist.
  */
 protected function publishFile($src)
 {
     \Yii::trace("src:{$src} ", __METHOD__);
     $dir = $this->hash($src);
     $fileName = basename($src);
     $dstDir = $this->basePath . DIRECTORY_SEPARATOR . $dir;
     $dstFile = $dstDir . DIRECTORY_SEPARATOR . $fileName;
     \Yii::trace("dstFile:{$dstFile} ", __METHOD__);
     if (!is_dir($dstDir)) {
         FileHelper::createDirectory($dstDir, $this->dirMode, true);
     }
     if ($this->linkAssets) {
         if (!is_file($dstFile)) {
             symlink($src, $dstFile);
         }
     } elseif (@filemtime($dstFile) < @filemtime($src)) {
         copy($src, $dstFile);
         if ($this->fileMode !== null) {
             @chmod($dstFile, $this->fileMode);
         }
     }
     $result = [$dstFile, $this->baseUrl . "/{$dir}/{$fileName}"];
     \Yii::trace("result:{$result} ", __METHOD__);
     return $result;
 }
开发者ID:NetClearly,项目名称:yii2-extensions,代码行数:31,代码来源:StaticAssetManager.php

示例2: getFile

 public static function getFile($fileName, $fileType = 'csv')
 {
     //make sure the file name is unqiue
     $fileName = Yii::$app->getRuntimePath() . '/temp/' . $fileName . '.' . strtolower($fileType);
     $filePath = dirname($fileName);
     if (!is_dir($filePath)) {
         FileHelper::createDirectory($filePath, 0777, true);
     }
     return $fileName;
 }
开发者ID:timelessmemory,项目名称:uhkklp,代码行数:10,代码来源:ExportSampleRecord.php

示例3: _getRealFilePath

 /**
  * Generate the actual filesystem path for a filekey
  */
 protected function _getRealFilePath($filekey, $createDir = true)
 {
     $filekey = substr(sha1($filekey), 0, 32);
     $path = sprintf('%s/%s/', rtrim($this->_filepath, '/'), substr($filekey, 0, self::STUB_KEY_LENGTH));
     // ensure directory path exists
     if ($createDir && !is_dir($path)) {
         FileHelper::createDirectory($path);
     }
     return $path . $filekey;
 }
开发者ID:99designs,项目名称:cabinet,代码行数:13,代码来源:FilesystemFileStore.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->uploadRootPath) {
         throw new InvalidConfigException('The "savePath" attribute must be set.');
     } else {
         $this->uploadRootPath = rtrim(Yii::getAlias($this->uploadRootPath), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
         if (!file_exists($this->uploadRootPath) && !FileHelper::createDirectory($this->uploadRootPath)) {
             throw new InvalidCallException('Directory specified in "savePath" attribute doesn\'t exist or cannot be created.');
         }
     }
 }
开发者ID:EugeneJk,项目名称:yii2-custom-fields,代码行数:15,代码来源:ImageCropAction.php

示例5: getFlywheelRepo

 /**
  *
  * @return \JamesMoss\Flywheel\Repository
  */
 private function getFlywheelRepo($module)
 {
     if (!isset($this->flywheel_config)) {
         $config_dir = \Yii::getAlias($module->flywheel_config);
         if (!file_exists($config_dir)) {
             FileHelper::createDirectory($config_dir);
         }
         $this->flywheel_config = new Config($config_dir);
     }
     if (!isset($this->flywheel_repo)) {
         $this->flywheel_repo = new Repository($module->flywheel_repo, $this->flywheel_config);
     }
     return $this->flywheel_repo;
 }
开发者ID:jacmoe,项目名称:yii2-mdpages-module,代码行数:18,代码来源:WikilinkTrait.php

示例6: store

 /**
  * store cht log
  * @param null $filename filename
  * @return bool
  * @throws \pinst\exception\ExitException
  */
 public function store($filename = null)
 {
     if (empty($filename)) {
         $filename = \Pinst::$app->runtimePath . DIRECTORY_SEPARATOR . "msg";
         if (!is_dir($filename)) {
             FileHelper::createDirectory($filename);
         }
     }
     $filename .= DIRECTORY_SEPARATOR . $this->getProperty("client_id") . '_' . time();
     $fp = fopen($filename, "a+");
     if (!$fp) {
         return false;
     }
     foreach ($this->message as $msg) {
         fwrite($fp, '[' . date("Y/m/d H:i:s", $msg['time']) . ']' . $msg['content']);
     }
     fclose($fp);
 }
开发者ID:aoyel,项目名称:pinst,代码行数:24,代码来源:Connection.php


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