1. Go to this page and download the library: Download bestyii/yii2-aliyun-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/ */
use League\Flysystem\AdapterInterface;
Yii::$app->fs->write('filename.ext', 'contents', [
'visibility' => AdapterInterface::VISIBILITY_PRIVATE
]);
use League\Flysystem\AdapterInterface;
if (Yii::$app->fs->getVisibility('filename.ext') === AdapterInterface::VISIBILITY_PRIVATE) {
Yii::$app->fs->setVisibility('filename.ext', AdapterInterface::VISIBILITY_PUBLIC);
}
$contents = Yii::$app->fs->listContents();
foreach ($contents as $object) {
echo $object['basename']
. ' is located at' . $object['path']
. ' and is a ' . $object['type'];
}