PHP code example of saviorlv / yii2-aliyun-oss

1. Go to this page and download the library: Download saviorlv/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/ */

    

saviorlv / yii2-aliyun-oss example snippets


components => [
    'oss' => [
        'class' => 'Saviorlv\Aliyun\OSS',
        'accessKeyId' => 'xxxxx', // 阿里云AccessKeyID
        'accessKeySecret' => 'xxxx', // 阿里云 AccessKeySecret
        'bucket' => 'xxx', // bucket
        'endpoint' => 'http://oss-cn-hangzhou.aliyuncs.com', //OSS节点地址
    ],
]

 \Yii::$app->oss->upload($object,$file);