oss php sdk-2.0.5怎么使用
你直接引入包就可以了的
if (is_file(__DIR__ . '/../autoload.php')) {
require_once __DIR__ . '/../autoload.php';
}if (is_file(__DIR__ . '/../vendor/autoload.php')) {
require_once __DIR__ . '/../vendor/autoload.php';
}use OSSOssClient;use OSSCoreOssUtil;use OSSCoreOssException;
try{
//putobject();
}catch (Exception $ex){
die($ex->getMessage());
}
function putobject(){
$accessKeyId = ' '; ;
$accessKeySecret = ' ';
$endpoint = 'oss-cn-hangzhou.aliyuncs.com';
$bucket= 'bucket名称';
$object = 'a.txt';
$content = 'Hi, OSS.';
try {
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
$response = $ossClient->putObject($bucket, $object, $content);
} catch (OssException $e) {
print $e->getMessage();
}
}类似这样的引入应用就可以了的
赞0
踩0