PHP code example of xzncit / oss

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

    

xzncit / oss example snippets




use xzncit\oss;

try {
    // OSS
    $app = OSS::create("aliyuncs",[ ... ]);
    
    // 上传资源
    $response = $app->upload("image.png");
    
    // 返回信息
    var_dump($response);
}catch (\Exception $ex){
    echo("error: ".$ex->getMessage());
}