PHP code example of ofcold / flysystem-ali_oss
1. Go to this page and download the library: Download ofcold/flysystem-ali_oss library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ofcold / flysystem-ali_oss example snippets
use League\Flysystem\Filesystem;
use League\Flysystem\MountManager;
use Illuminate\Filesystem\FilesystemManager;
$driver = new Filesystem(new OssAdapter(
new OssClient(
'key',
'secret',
'endpoint'
),
'bucket',
'endpoint',
'Your prefix'
));
app(MountManager::class)->mountFilesystem($prefix, $driver);
app(FilesystemManager::class)->extend(
$this->disk->getSlug(),
function () use ($driver) {
return $driver;
}
);