PHP非AWS處理天翼雲OOS對象存儲

首先要找對sdk

看了好久 以爲要AWS才能使用,最後發現這個和AWS沒有關係!!!

完全沒有用:
https://www.ctyun.cn/help2/10000101

Error retrieving credentials from the instance profile metadata server. (cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))
Error retrieving credentials from the instance profile metadata server. (cURL error 28: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))


實際上要看這裏
http://oos-cn.ctyunapi.cn/docs/oos/sdk/PHP/OOS%20PHP%20SDK%E5%BC%80%E5%8F%91%E8%80%85%E6%8C%87%E5%8D%97.pdf

從官方渠道下載 oos-php-sdk.zip,解壓到相應位置。網址爲:
http://oos-cn.ctyunapi.cn/sdk/oos/PHP/oos-php-sdk.zip
use OOS\Core\OosException;
use OOS\OosClient;


$oosClient = new OosClient('a03d2911ffe', '403fa92aa3a32d1fe5e988b18', 'oos-cn.ctyunapi.cn', false);
 try {
		$oosClient->putObject('6860', 'html.html', 'body_stream');
		$oosClient->uploadFile('6843','html.html', 'c:/html.html');
} catch (OosException $e) {
            return  $e->getErrorMessage();
}

搞定

發佈了63 篇原創文章 · 獲贊 30 · 訪問量 31萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章