本文整理匯總了PHP中League\Flysystem\FilesystemInterface::copy方法的典型用法代碼示例。如果您正苦於以下問題:PHP FilesystemInterface::copy方法的具體用法?PHP FilesystemInterface::copy怎麽用?PHP FilesystemInterface::copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類League\Flysystem\FilesystemInterface
的用法示例。
在下文中一共展示了FilesystemInterface::copy方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: copyFile
protected function copyFile($fromFullPath, $toFullPath, $replace = false)
{
$this->createDirectory(dirname($toFullPath));
if ($replace) {
$this->filesystem->delete($toFullPath);
}
if (!$this->filesystem->copy($fromFullPath, $toFullPath)) {
throw new CommandErrorException('File cannot be copied to the path ' . $toFullPath);
}
}
示例2: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return string|bool
**/
protected function _copy($source, $target, $name)
{
$path = $this->_joinPath($target, $name);
if ($this->fs->copy($source, $path) === false) {
return false;
}
return $path;
}
示例3: copy
/**
* Copy a file.
*
* @param string $source
* @param string $destination
* @throws IoWriteException
*/
public function copy($source, $destination)
{
try {
$this->fs->copy($source, $destination);
} catch (Error $ex) {
throw new IoWriteException("File {$source} could not have benn copied to {$destination}.", $ex);
} catch (Exception $ex) {
throw new IoWriteException("File {$source} could not have benn copied to {$destination}.", $ex);
}
}
示例4: copyFolderRecursively
/**
* @param string $trimmedSourcePath
* @param string $trimmedTargetPath
* @return bool
*/
protected function copyFolderRecursively($trimmedSourcePath, $trimmedTargetPath)
{
try {
$contents = $this->filesystem->listContents($trimmedSourcePath, true);
foreach ($contents as $item) {
if ('file' === $item['type']) {
try {
$relPath = substr_replace($trimmedSourcePath, '', 0, strlen($item['path']));
$targetPath = $trimmedTargetPath . $relPath . '/' . $item['basename'];
$this->filesystem->copy($item['path'], $targetPath);
} catch (FileExistsException $fee) {
continue;
} catch (FileNotFoundException $fnfe) {
return false;
}
}
}
} catch (\Exception $e) {
return false;
}
return true;
}
示例5: copy
/**
* Copy a file to a new location.
*
* @param string $from
* @param string $to
* @return bool
*/
public function copy($from, $to)
{
return $this->driver->copy($from, $to);
}
示例6: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return bool
**/
protected function _copy($source, $target, $name)
{
return $this->fs->copy($source, $this->_joinPath($target, $name));
}
示例7: move
/**
* Move a file to a new location.
*
* @param string $from
* @param string $to
* @return bool
*/
public function move($from, $to)
{
$this->driver->copy($from, $to);
$this->driver->delete($from);
}
示例8: _copy
/**
* Copy file into another file
*
* @param string $source source file path
* @param string $target target directory path
* @param string $name new file name
* @return string|bool
**/
protected function _copy($source, $target, $name)
{
$path = $this->_joinPath($target, $name);
return $this->_resultPath($this->fs->copy($source, $path), $path);
}
示例9: copy
/**
* Copy a file.
*
* @param string $path Path to the existing file.
* @param string $newpath The new path of the file.
*
* @throws FileExistsException Thrown if $newpath exists.
* @throws FileNotFoundException Thrown if $path does not exist.
*
* @return bool True on success, false on failure.
*/
public function copy($path, $newpath)
{
return $this->fileSystem->copy($path, $newpath);
}