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


PHP FileSystem::copy方法代码示例

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


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

示例1: storeLearningMaterialFile

 /**
  * Store a learning material file and return the relativePath
  * @param File $file
  * @param boolean $preserveOriginalFile
  * @return string $relativePath
  */
 public function storeLearningMaterialFile(File $file, $preserveOriginalFile = true)
 {
     $relativePath = $this->getLearningMaterialFilePath($file);
     $fullPath = $this->getPath($relativePath);
     $dir = dirname($fullPath);
     $this->fileSystem->mkdir($dir);
     if ($preserveOriginalFile) {
         $this->fileSystem->copy($file->getPathname(), $fullPath, false);
     } else {
         if (!$this->fileSystem->exists($fullPath)) {
             $this->fileSystem->rename($file->getPathname(), $fullPath);
         }
     }
     return $relativePath;
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:21,代码来源:IliosFileSystem.php

示例2: deepCopy

 public static function deepCopy($src, $dest, array $patternMatch = null)
 {
     $fileSystem = new FileSystem();
     if (!$fileSystem->exists($src)) {
         return;
     }
     if (!$fileSystem->exists($dest)) {
         $fileSystem->mkdir($dest, 0777);
     }
     $match = false;
     if (!empty($patternMatch) && count($patternMatch) == 2) {
         $match = true;
     }
     $fileCount = 0;
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $path) {
         if ($match && $patternMatch[0]->{$patternMatch}[1]($path->getPathname())) {
             continue;
         }
         $relativeFile = str_replace($src, '', $path->getPathname());
         $destFile = $dest . $relativeFile;
         if ($path->isDir()) {
             if (!$fileSystem->exists($destFile)) {
                 $fileSystem->mkdir($destFile, 0777);
             }
         } else {
             if (strpos($path->getFilename(), ".") === 0) {
                 continue;
             }
             $fileSystem->copy($path->getPathname(), $destFile, true);
             $fileCount++;
         }
     }
     return $fileCount;
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:34,代码来源:FileUtil.php

示例3: copyFile

 /**
  * @param $origin file path
  * @param $destinationDirectory destination directory path
  * @return StandardResponseInterface
  */
 public function copyFile($origin, $destinationDirectory)
 {
     $fullPath = $this->getRealPath($origin);
     $fullDestinationPath = $this->getRealPath($destinationDirectory);
     $this->fs->copy($fullPath, $fullDestinationPath . '/' . basename($fullPath));
     return new StandardResponse();
 }
开发者ID:tamcy,项目名称:ElendevRoxyFilemanBundle,代码行数:12,代码来源:LocalFileSystem.php

示例4: copy

 /**
  * Copy a file, takes care of symbolic links
  *
  * @param PhingFile $src Source path and name file to copy.
  * @param PhingFile $dest Destination path and name of new file.
  *
  * @return void     
  * @throws Exception if file cannot be copied.
  */
 function copy(PhingFile $src, PhingFile $dest)
 {
     global $php_errormsg;
     if (!$src->isLink()) {
         return parent::copy($src, $dest);
     }
     $srcPath = $src->getAbsolutePath();
     $destPath = $dest->getAbsolutePath();
     $linkTarget = $src->getLinkTarget();
     if (false === @symlink($linkTarget, $destPath)) {
         $msg = "FileSystem::copy() FAILED. Cannot create symlink from {$destPath} to {$linkTarget}.";
         throw new Exception($msg);
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:23,代码来源:UnixFileSystem.php

示例5: protectDirectory

 /**
  * Installs .htaccess and web.config to the given path
  *
  * @param string $path
  */
 public static function protectDirectory($path)
 {
     $templatesLocation = __DIR__ . "/../Initialization";
     FileSystem::copy("{$templatesLocation}/.htaccess.tpl", "{$path}/.htaccess");
     FileSystem::copy("{$templatesLocation}/web.tpl.config", "{$path}/web.config");
 }
开发者ID:versionpress,项目名称:versionpress,代码行数:11,代码来源:SecurityUtils.php


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