我装的镜像服务器(centos+nginx+php),下载oss SDK 2.0版本
按照这个 http://aliyun_portal_storage.oss.aliyuncs.com/oss_api/oss_phphtml/quickstart.html
写
<?phprequire_once '/path/to/sdk/aliyun.php';use \Aliyun\OSS\OSSClient;$client = OSSClient::factory(array('AccessKeyId' => '','AccessKeySecret' => '',));
$client->putObject(array(
'Bucket'=>'youxuepai',
'Key'=> 'effded',
'Content'=>'This is my content'
));
(注:代码中 accesskeyid和accesskeysecret保证正确)
就无法运行,报莫名其妙的错误:
Fatal error: Uncaught exception'Aliyun\OSS\Exceptions\OSSException' with message 'The bucket you areattempting to access must be addressed using the specified endpoint.Please send all future requests to this endpoint.' in/alidata/www/default/aliyun/src/Aliyun/OSS/Utilities/OSSExceptionFactory.php:16Stacktrace:#0/alidata/www/default/aliyun/src/Aliyun/OSS/ResponseHandlers/OSSErrorResponseHandler.php(29):Aliyun\OSS\Utilities\OSSExceptionFactory->createFromError(Object(Aliyun\OSS\Models\OSSError))#1/alidata/www/default/aliyun/src/Aliyun/Common/Communication/OpenServiceClient.php(40):Aliyun\OSS\ResponseHandlers\OSSErrorResponseHandler->handle(Object(Aliyun\Common\Communication\HttpResponse))#2/alidata/www/default/aliyun/src/Aliyun/Common/Communication/RetryableServiceClient.php(32):Aliyun\Common\Communication\OpenServiceClient->sendRequest(Object(Aliyun\Common\Communication\HttpRequest),Object(Aliyun\Common\Communication\ExecutionContext))#3 /alidata/www/default/aliyun/src/Aliyun/Common/Communication/Retryablein
/alidata/www/default/aliyun/src/Aliyun/OSS/Utilities/OSSExceptionFactory.php on line
16
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。