PHP code example of vivlong / phalapi-aliyun-oss

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

    

vivlong / phalapi-aliyun-oss example snippets


    /**
     * 阿里云OSS相关配置
     */
    'AliyunOss' =>  array(
        'accessKeyId'       => '<yourAccessKeyId>',
        'accessKeySecret'   => '<yourAccessKeySecret>',
        'bucket'            => '<yourBucketName>',
        'endpoint'          => 'http://oss-cn-hangzhou.aliyuncs.com',
        'isCName'           => false,
        'securityToken'     => null,
        'requestProxy'      => null,
    ),

$di->aliyunOss = function() {
        return new \PhalApi\AliyunOss\Lite();
};

  \PhalApi\DI()->aliyunOss->uploadFile($bucket, $object, $filePath);