本文整理汇总了PHP中app\File::copy方法的典型用法代码示例。如果您正苦于以下问题:PHP File::copy方法的具体用法?PHP File::copy怎么用?PHP File::copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\File
的用法示例。
在下文中一共展示了File::copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putFile
/**
* Saves a file
* @param string $sourcePath An absolute local path to a file name to read from.
* @param string $destinationFileName A storage file name to save to.
* @return bool
*/
protected function putFile($sourcePath, $destinationFileName = null)
{
if (!$destinationFileName) {
$destinationFileName = $this->disk_name;
}
$destinationPath = $this->getStorageDirectory() . $this->getPartitionDirectory();
if (!$this->isLocalStorage()) {
return $this->copyLocalToStorage($sourcePath, $destinationPath . $destinationFileName);
}
/*
* Using local storage, tack on the root path and work locally
* this will ensure the correct permissions are used.
*/
$destinationPath = $this->getLocalRootPath() . '/' . $destinationPath;
if (!FileHelper::isDirectory($destinationPath)) {
FileHelper::makeDirectory($destinationPath, 0777, true);
}
return FileHelper::copy($sourcePath, $destinationPath . $destinationFileName);
}