PHP code example of wsmallnews / laravel-cos

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

    

wsmallnews / laravel-cos example snippets


use Smallnews\Cos\QCloudCosOper;

public function getAppId(){
    echo QCloudCosOper::getAppId();
}

QCloudCosOper::setBucket($bucket);                  // 设置bucket
QCloudCosOper::getBucket();                         // 获取bucket
QCloudCosOper::getAppId();                          // 获取 appId
QCloudCosOper::createFolder($folder);               // 创建目录
QCloudCosOper::upload($srcPath, $dstPath);          // 上传文件
QCloudCosOper::listFolder($folder);                 // 目录列表
QCloudCosOper::prefixSearch($prefix);               // 目录列表(前缀搜索)
QCloudCosOper::updateFolder($folder);               // 更新目录

QCloudCosOper::statFolder($folder);                 // 查询目录信息
QCloudCosOper::stat($path);                         // 查询文件信息
QCloudCosOper::copyFile($srcFpath, $dstFpath);      // 复制一个文件
QCloudCosOper::moveFile($srcFpath, $dstFpath);      // 移动一个文件
QCloudCosOper::delFile($path);                      // 删除文件
QCloudCosOper::delFolder($folder);                  // 删除目录