本文整理汇总了PHP中League\Flysystem\FilesystemInterface::writeStream方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemInterface::writeStream方法的具体用法?PHP FilesystemInterface::writeStream怎么用?PHP FilesystemInterface::writeStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\FilesystemInterface
的用法示例。
在下文中一共展示了FilesystemInterface::writeStream方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create(BinaryFileCreateStruct $binaryFileCreateStruct)
{
try {
$this->filesystem->writeStream($binaryFileCreateStruct->id, $binaryFileCreateStruct->getInputStream(), array('mimetype' => $binaryFileCreateStruct->mimeType, 'visibility' => AdapterInterface::VISIBILITY_PUBLIC));
} catch (FileExistsException $e) {
$this->filesystem->updateStream($binaryFileCreateStruct->id, $binaryFileCreateStruct->getInputStream(), array('mimetype' => $binaryFileCreateStruct->mimeType, 'visibility' => AdapterInterface::VISIBILITY_PUBLIC));
}
}
示例2: move
/**
* @param string|FilesystemInterface $moveTo
* @return $this
*/
public function move($moveTo)
{
if ($this->fileSystem) {
$this->moveToFile($moveTo);
} else {
$fp = fopen($this->getFileName(), 'r+');
$this->fileSystem->writeStream($moveTo, $fp);
fclose($fp);
}
$this->config[self::FILE_LOC] = $moveTo;
return $this;
}
示例3: move
/**
* @param string $sourcePath
* @param string $targetPath
*
* @return bool
*/
protected function move($sourcePath, $targetPath)
{
if ($this->filesystem->has($targetPath)) {
return false;
}
$stream = fopen($sourcePath, 'r+');
if ($stream === null) {
return false;
}
$success = $this->filesystem->writeStream($targetPath, $stream);
if (fclose($stream) === false) {
return false;
}
return $success;
}
示例4: writeStream
/**
* Write a new file using a stream.
*
* @param string $path The path of the new file.
* @param resource $resource The file handle.
* @param array $config An optional configuration array.
*
* @throws \League\Flysystem\InvalidArgumentException If $resource is not a file handle.
* @throws FileExistsException
*
* @return bool True on success, false on failure.
*/
public function writeStream($path, $resource, array $config = [])
{
return $this->fileSystem->writeStream($path, $resource, $config);
}
示例5: write
/**
* @param resource $stream
*/
public function write($stream)
{
$this->_filesystem->delete($this->getPath());
$this->_filesystem->writeStream($this->getPath(), $stream);
}