PHP code example of colee / yii2-oss

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

    

colee / yii2-oss example snippets

 php
\Yii::$app->oss->upload2oss($tempName, $path=null); // 将文件上传
\Yii::$app->oss->uploadStream2oss($stream,$path=null); // 将字节流上传
\Yii::$app->oss->getItem($path);  // 获取源文件访问URL,$path为资源在OSS中的路径
\Yii::$app->oss->getImageUrl($path, $style); // 获取缩略图URL,$style对应尺寸样式(在OSS图片服务中定义)