PHP code example of lihaijiang / aliyun-itxdl-oss

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

    

lihaijiang / aliyun-itxdl-oss example snippets


... ...

  private $city = '北京';

  private $networkType = '经典网络';
  
  private $AccessKeyId = '';
  private $AccessKeySecret = '';

... ...

use App\Services\OSS;

// 在外网上传一个文件并指定 options 如:Content-Type 类型
// 更多 options 见:https://github.com/LiHaijiang/AliyunOSS/blob/master/src/oss/src/Aliyun/OSS/OSSClient.php#L142-L148
OSS::publicUpload('bucket', '目标 object 名', '本地文件路径', [
    'ContentType' => 'application/pdf',
    ... ...
]);