JohnLui/AliyunOSS v2.0 发布,大幅优化了 API 易用性,改进了文件结构
___ __ _ ____ _____ _____ / | / / (_) __ __ __ __ ____ / __ \ / ___/ / ___/ / /| | / / / / / / / / / / / / / __ \ / / / / \__ \ \__ \ / ___ | / / / / / /_/ / / /_/ / / / / / / /_/ / ___/ / ___/ / /_/ |_|/_/ /_/ \__, / \__,_/ /_/ /_/ \____/ /____/ /____/ /____/
适配 Laravel 7 的新包已经发布:AliyunOSS-Laravel7
AliyunOSS 是阿里云 OSS 官方 SDK 的 Composer 封装,支持任何 PHP 项目,包括 Laravel、Symfony、TinyLara 等等。Github 地址:https://github.com/johnlui/AliyunOSS
更新记录
-
2017-03-08
Release v2.0.0
v2 发布,在 API 易用性上进行了大量优化 -
2016-09-12
Release v1.3.5
加入文件元信息的设置功能 -
2016-07-20
Release v1.3.4
加入文件元信息的获取功能 -
2016-07-20
Release v1.3.4
加入文件元信息的获取功能 -
2016-01-31
Release v1.3.2
获取指定虚拟文件夹下的所有文件 -
2015-10-23
Release v1.3
增加删除、复制、移动文件功能 -
2015-08-07
Release v1.2
修复内存泄露 bug -
2015-01-12
Release v1.1
增加内外网配置分离 -
2015-01-09
Release v1.0
完善功能,增加 Laravel 框架详细使用教程及代码
安装
安装有两种方式:
① 直接编辑配置文件
将以下内容增加到 composer.json:
require: { "johnlui/aliyun-oss": "~2.0" }
然后运行 composer update
。
② 执行命令安装
运行命令:
composer require johnlui/aliyun-oss:~2.0
使用(以 Laravel 为例)
构建 Service 文件
新建 app/services/OSS.php,内容可参考:OSS.php,然后修改配置:
... ... private $city = '青岛'; // 经典网络 or VPC private $networkType = '经典网络'; private $AccessKeyId = ''; private $AccessKeySecret = ''; ... ...
放入自动加载
遵循 psr-0 的项目(如Laravel 4、CodeIgniter、TinyLara)中:
在 composer.json 中 autoload -> classmap 处增加配置:
"autoload": { "classmap": [ "app/services" ] }
然后运行 composer dump-autoload。
遵循 psr-4 的项目(如 Laravel 5、Symfony)中:
无需配置,保证目录 App/Services
和命名空间 namespace App\Services;
一致即可自动加载。
使用
use App\Services\OSS; // 在外网上传一个文件并指定 options 如:Content-Type 类型 // 更多 options 见:https://github.com/johnlui/AliyunOSS/blob/master/src/oss/src/Aliyun/OSS/OSSClient.php#L142-L148 OSS::publicUpload('bucket', '目标 object 名', '本地文件路径', [ 'ContentType' => 'application/pdf', ... ... ]);
更多用法等待着你去发现:https://github.com/johnlui/AliyunOSS/blob/master/example/OSS.php
反馈
有问题请在本文下面留言。
License
除 “版权所有(C)阿里云计算有限公司” 的代码文件外,遵循 MIT license 开源。
评论:
2021-06-01 17:27
[0] ThrowableError in EventDispatcher.php line 48
类型错误: Argument 1 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an object, string given, called in /www/wwwroot/jiaoyou_web/vendor/johnlui/aliyun-oss/src/oss/libs/guzzle/common/Guzzle/Common/AbstractHasDispatcher.php on line 40
{
if (__CLASS__ === static::class) {
$this->optimized = [];
}
}
/**
* {@inheritdoc}
*/
public function dispatch(object $event, string $eventName = null): object
{
$eventName = $eventName ?? \get_class($event);
if (null !== $this->optimized) {
$listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
} else {
$listeners = $this->getListeners($eventName);
}
Call Stack
in EventDispatcher.php line 48
at EventDispatcher->dispatch('client.create_reques...', object(Event)) in AbstractHasDispatcher.php line 40
at AbstractHasDispatcher->dispatch('client.create_reques...', ['client' => object(Client), 'request' => object(EntityEnclosingRequest)]) in Client.php line 450
at Client->prepareRequest(object(EntityEnclosingRequest), []) in Client.php line 199
at Client->createRequest('PUT', 'http://test-jiaoyou....', ['Content-Length' => '12227', 'Content-Type' => 'application/octet-st...', 'Date' => 'Tue, 01 Jun 2021 09:...', ...], object(ReadLimitEntityBody)) in HttpServiceClient.php line 119
at HttpServiceClient->buildCoreRequest(object(HttpRequest)) in HttpServiceClient.php line 56
at HttpServiceClient->sendRequest(object(HttpRequest), object(ExecutionContext)) in OpenServiceClient.php line 37
at OpenServiceClient->sendRequest(object(HttpRequest), object(ExecutionContext)) in RetryableServiceClient.php line 32
at RetryableServiceClient->sendRequestImpl(object(HttpRequest), object(ExecutionContext), 0) in RetryableServiceClient.php line 27
at RetryableServiceClient->sendRequest(object(HttpRequest), object(ExecutionContext)) in Command.php line 121
at Command->execute(['Endpoint' => 'http://oss-cn-shenzh...', 'AccessKeyId' => 'LTAIeOopj0aHBw7Y', 'AccessKeySecret' => 'HsdlmsiBVIorEwGTLs1E...'], ['Bucket' => 'test-jiaoyou', 'Key' => 'jiaoyou/jyaaaaaaaaaa...', 'Content' => resource, ...]) in OSSClient.php line 429
at OSSClient->execute('putObject', ['Bucket' => 'test-jiaoyou', 'Key' => 'jiaoyou/jyaaaaaaaaaa...', 'Content' => resource, ...]) in OSSClient.php line 153
at OSSClient->putObject(['Bucket' => 'test-jiaoyou', 'Key' => 'jiaoyou/jyaaaaaaaaaa...', 'Content' => resource, ...]) in AliyunOSS.php line 101
at AliyunOSS->uploadFile('jiaoyou/jyaaaaaaaaaa...', '/www/wwwroot/jiaoyou...', []) in FileLogic.php line 141
at FileLogic::ossUploadFile('/www/wwwroot/jiaoyou...', 'teacher', '', 1, '', []) in FileLogic.php line 96
at FileLogic::uploadLocalFile('/www/wwwroot/jiaoyou...', 'teacher') in Test.php line 99
at Test->upload()
at ReflectionMethod->invokeArgs(object(Test), []) in Container.php line 395
at Container->invokeReflectMethod(object(Test), object(ReflectionMethod), ['s' => '//admin/web.test/upl...']) in Module.php line 131
at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
at Middleware->think\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
at Middleware->dispatch(object(Request), 'controller') in Module.php line 136
at Module->exec() in Dispatch.php line 168
at Dispatch->run() in App.php line 432
at App->think\{closure}(object(Request), object(Closure), null)
at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
at Middleware->think\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
at Middleware->dispatch(object(Request)) in App.php line 435
at App->run() in index.php line 26
2020-08-28 17:23
Fatal error: Cannot declare class Symfony\Component\ClassLoader\UniversalClassLoader, because the name is already in use in /home/wwwroot/app/vendor/johnlui/aliyun-oss-laravel7/src/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php on line 61
怎么避免引入文件冲突
2020-04-07 16:50
laravel版本 -- Laravel Framework 7.2.2
2020-01-07 11:45
2019-09-30 09:43
返回结果 :"http://phpnb.oss-cn-hongkong.aliyuncs.com/89005FCCF6D9D2126A29CCFF9DAEAC52"
请问 大佬 我是上传的图片 怎么能让他直接显示啊?
2019-08-22 17:10
$bucket = '*******‘
我现在的情况是:
我的阿里oss 有一个bucket名为 blog,在blog下面有很多二级或三级目录。
当我用这个插件把bucket设置为blog时,图片能正常上传到该目录下,
但是我想把图片上传到二级目录,也就是blog/picture等。
我试图把bucket名定义为 /blog/picture 运行的时候发现行不通。
请帮帮忙~!
2018-07-02 20:14
这个是什么原因呀,用AliyunOSS.php里面的getUrl方法都能正常获取到图片下载地址呢,求解答呀
2018-06-01 11:10
Symfony\Component\Debug\Exception\FatalThrowableError
/vendor/johnlui/aliyun-oss/src/AliyunOSS.php86
86行内容是 public static function boot($city, $networkType, $isInternal, $AccessKeyId, $AccessKeySecret)
请问 在app/services/oss.php文件 从您Git上粘贴下来 还有要修改的地方吗?
vendor下的包里 vendor/johnlui/aliyun-oss/src/AliyunOSS.php里还有要 改的地方吗
2018-05-31 18:56
1 . require: "johnlui/aliyun-oss": "~2.0"以后,再composer update , vendor 里并没有aliyun-oss这个文件 夹是正常吗?
新建了app/services/OSS.php文件后,就报错了 说找不到文件中use JohnLui\AliyunOSS\AliyunOSS; 这个类
2018-05-29 10:57
public static function upload($ossKey, $filePath)
{
$oss = new OSS(self::$internal); // 上传文件使用内网,免流量费
$oss->ossClient->setBucket(config('alioss.BucketName'));
$res = $oss->ossClient->uploadFile($ossKey, $filePath, ['ContentType' => mime_content_type($filePath)]);
return $res;
}
2018-05-07 13:54
//oss容器名称
$bucket = '*******';
//oss文件名称
$object = time().rand(100000,999999).'.mp4';
//获取文件路径
$file = $request->file('video');
$path = $file->getRealPath();
//获取文件大小
$size = $file->getClientSize();
//换算成MB
$size = $size / 1048576;
if($size > 2500){
return back()->with('error','文件过大');
}
$retuest = OSS::publicUpload($bucket,$object,$path);
2018-03-16 15:54
并重写了AliyunOSS
public function __construct($city, $networkType, $isInternal, $AccessKeyId, $AccessKeySecret)
{
$this->city = $city;
$this->networkType = $networkType;
$serverAddress = env('ServerAdd'); //在.env文件中定义的为http://honsenflag.com
$this->ossClient = OSSClient::factory([
OSSOptions::ENDPOINT => $serverAddress,
'AccessKeyId' => $AccessKeyId,
'AccessKeySecret' => $AccessKeySecret,
]);
}
然后在使用的时候报下面的错误是什么原因啊???
ClientException in HttpServiceClient.php line 93:
[curl] 6: Could not resolve host: honsenflagstorage.honsenflag.com; Unknown error [url] http://honsenflagstorage.honsenflag.com/
2017-11-30 10:57
配置好后报的权限问题,这是怎么回事
2017-11-11 23:07
["eTag":"Aliyun\OSS\Models\PutObjectResult":private]=>
string(32) "D41D8CD98F00B204E9800998ECF8427E"
}
2017-11-11 22:47
返回成功还是失败怎么判断啊?
2017-09-07 18:16
我这边接收到的图片是base64的格式,我看到有一个方法publicUploadContent这个是可以用来上传文件变量内容的,但是会给我返回一个错误:The specified object is not valid.
请问这是什么意思
2017-08-31 14:13
- laravel/laravel v5.2.0 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[5.2.41, 5.2.x-dev, v5.2.0, v5.2.0-beta1, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.32, v5.2.33, v5.2.34, v5.2.35, v5.2.36, v5.2.37, v5.2.38, v5.2.39, v5.2.4, v5.2.40, v5.2.42, v5.2.43, v5.2.44, v5.2.45, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9] but these conflict with your requirements or minimum-stability.
- Installation request for laravel/laravel No version set (parsed as 1.0.0) -> satisfiable by laravel/laravel[No version set (parsed as 1.0.0)].
- overtrue/laravel-follow 1.0 requires laravel/laravel ^5.1 -> satisfiable by laravel/laravel[v5.1.0, v5.1.1, v5.1.11, v5.1.3, v5.1.33, v5.1.4, v5.2.0, v5.2.15, v5.2.23, v5.2.24, v5.2.27, v5.2.29, v5.2.31, v5.3.0, v5.3.10, v5.3.16, v5.3.30, v5.4.0, v5.4.15, v5.4.16, v5.4.19, v5.4.21, v5.4.23, v5.4.3, v5.4.30, v5.4.9, v5.5.0].
- Can only install one of: laravel/laravel[v5.1.0, No version set (parsed as 1.0.0)].
- Can only install one of: laravel/laravel[v5.1.1, No version set (parsed as 1.0.0)].
- Can only install one of: laravel/laravel[v5.1.11, No version set (parsed as 1.0.0)].
- Can only install one of: laravel/laravel[v5.1.3, No version set (parsed as 1.0.0)].
- Can only install one of: laravel/laravel[v5.1.33, No version set (parsed as 1.0.0)].
- Can only install one of: laravel/laravel[v5.1.4, No version set (parsed as 1.0.0)].
- Installation request for overtrue/laravel-follow 1.0 -> satisfiable by overtrue/laravel-follow[1.0].
是不支持5.1的吗?
2017-07-14 15:21
options = array(
OssClient::OSS_PROCESS => "image/resize,m_lfit,h_100,w_100" );
$signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "GET", $options);
JohnLui 老师啥时候更新一下
2017-07-07 19:42
当前我上传文件是前端ajax传递到控制器的(文件可能偏大),所以前端就有上传进度展示的需求了。
所以我的问题是:怎么去获取文件当前上传到OSS的进度呢?
2017-07-03 18:17
调用之后报
OSSException in OSSExceptionFactory.php line 16:
The specified object is not valid.
in OSSExceptionFactory.php line 16
at OSSExceptionFactory->createFromError(object(OSSError)) in OSSErrorResponseHandler.php line 29
at OSSErrorResponseHandler->handle(object(HttpResponse)) in OpenServiceClient.php line 40
at OpenServiceClient->sendRequest(object(HttpRequest), object(ExecutionContext)) in RetryableServiceClient.php line 32
at RetryableServiceClient->sendRequestImpl(object(HttpRequest), object(ExecutionContext), 0) in RetryableServiceClient.php line 27
at RetryableServiceClient->sendRequest(object(HttpRequest), object(ExecutionContext)) in Command.php line 121
at Command->execute(array('Endpoint' => 'http://oss-cn-qingdao.aliyuncs.com', 'AccessKeyId' => 'xxx', 'AccessKeySecret' => 'xxx'), array('Bucket' => 'xxx', 'Key' => '/ld/dn/1/2017-07-03/ceb8f4d00356cf6b27da38827bc0e784.jpg', 'Content' => resource, 'ContentLength' => 30225)) in OSSClient.php line 429
at OSSClient->execute('putObject', array('Bucket' => 'xxx', 'Key' => '/ld/dn/1/2017-07-03/ceb8f4d00356cf6b27da38827bc0e784.jpg', 'Content' => resource, 'ContentLength' => 30225)) in OSSClient.php line 153
at OSSClient->putObject(array('Bucket' => 'xxx', 'Key' => '/ld/dn/1/2017-07-03/ceb8f4d00356cf6b27da38827bc0e784.jpg', 'Content' => resource, 'ContentLength' => 30225)) in AliyunOSS.php line 105
at AliyunOSS->uploadFile('/ld/dn/1/2017-07-03/ceb8f4d00356cf6b27da38827bc0e784.jpg', 'E:\\Visual-NMP-x64\\tmp\\php25B1.tmp', array()) in OSSRepository.php line 53
at OSS::publicUpload('xxx', '/ld/dn/1/2017-07-03/ceb8f4d00356cf6b27da38827bc0e784.jpg', 'E:\\Visual-NMP-x64\\tmp\\php25B1.tmp') in UploaderController.php line 52
该如何解决呢。。。
2017-06-29 14:48
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
2017-06-13 21:17
ClientException in HttpServiceClient.php line 93:
[curl] 7: Failed to connect to chengzige.oss-cn-shanghai-internal.aliyuncs.com port 80: Timed out [url] http://chengzige.oss-cn-shanghai-internal.aliyuncs.com/79Z1qv3WdG.jpg
这是怎么回事啊
2017-02-08 19:34
The request signature we calculated does not match the signature you provided. Check your key and signing method.
检查了半天,accesskeyid、accesskeysecret、bucket和endpoint都确认是没错的
不知道是哪里出了问题?
2017-01-12 10:41
```
OSS::upload($avatar, storage_path('app/' . $avatar), [
'ContentType' => mime_content_type(storage_path('app/' . $avatar)),
'ContentDisposition' => 'inline'
]);
```
另外楼主提供的示例中 https://github.com/johnlui/AliyunOSS/blob/master/OSSExample.php#L23 的 upload 函数并没有接受 option 参数的形参,传了参数 $option 数组之后虽然没有报错,但是上传的图片并没有设置contenttype, 后来自己手动加上之后才可以。
2016-12-26 11:45
2016-11-17 11:34
namespace App\Services;
use JohnLui\AliyunOSS\AliyunOSS;
use Config;
class OSS {
private $ossClient;
public function __construct($isInternal = false)
{
$serverAddress = $isInternal ? Config::get('app.ossServerInternal') : Config::get('app.ossServer');
$this->ossClient = AliyunOSS::boot(
$serverAddress,
Config::get('app.AccessKeyId'),
Config::get('app.AccessKeySecret')
);
}
use config显示undefined class config ,然后运行的话会报一下错误
InvalidArgumentException in AssertUtils.php line 55:
Key [Endpoint] was not set.
in AssertUtils.php line 55
at AssertUtils::assertSet(array('Endpoint', 'AccessKeyId', 'AccessKeySecret'), array('MaxErrorRetry' => '3', 'UserAgent' => 'aliyun-sdk-php/2.0.0-beta', 'CurlOptions' => array(), 'Endpoint' => null, 'AccessKeyId' => null, 'AccessKeySecret' => null)) in OSSClient.php line 399
at OSSClient->__construct(array('Endpoint' => null, 'AccessKeyId' => null, 'AccessKeySecret' => null)) in OSSClient.php line 54
at OSSClient::factory(array('Endpoint' => null, 'AccessKeyId' => null, 'AccessKeySecret' => null)) in AliyunOSS.php line 24
at AliyunOSS->__construct(null, null, null) in AliyunOSS.php line 29
at AliyunOSS::boot(null, null, null) in OSS.php line 20
2016-10-08 12:14
oss::deleteObject();
deleteObject 这里面是访问路径还是上传路径?
2016-07-29 00:24
2016-07-29 00:01
2016-07-28 23:01
2016-07-10 21:36
2016-07-08 20:19
请问这个问题是怎么解决呢?我的endpoint都设置好了。upload出的问题,getBucket没问题的。求教。我用的是laravel 5.2。多谢!
2016-05-23 17:01
The scheme of endpoint is not set.
遇到了同样的问题,但外网地址什么的都设置了.dump出来查看也是有外网地址的.不知道什么原因望指教
2016-03-21 23:33
我使用的是Laravel5.2 ,用了您的包以后,使用OSS出现
ClientException in Command.php line 135:
Undefined index: host
这个如何解决?
2015-11-27 18:05
请问JohnLui/AliyunOSS会更新并升级吗?
2015-11-25 14:52
ClientException in Command.php line 135:
Undefined index: host
2015-11-23 16:20
The specified bucket is not valid.
yii2 配置一样出现这个情况,怎么回事呢?
2015-11-16 09:27
Maximum execution time of 30 seconds exceeded
我想可能是超时了,有没有配置项可以设置超时的时间
2015-10-28 15:45
InvalidArgumentException in AssertUtils.php line 55:
Key [Endpoint] was not set.
1. in AssertUtils.php line 55
2. at AssertUtils::assertSet(array('Endpoint', 'AccessKeyId', 'AccessKeySecret'), array('MaxErrorRetry' => '3', 'UserAgent' => 'aliyun-sdk-php/2.0.0-beta', 'CurlOptions' => array(), 'Endpoint' => null, 'AccessKeyId' => null, 'AccessKeySecret' => null)) in OSSClient.php line 399
配置如下:
'ossServer' => 'http://oss-cn-beijing.aliyuncs.com', //青岛为 http://oss-cn-qingdao.aliyuncs.com
'ossServerInternal' => 'http://oss-cn-beijing-internal.aliyuncs.com', //青岛为 http://oss-cn-qingdao-internal.aliyuncs.com
'AccessKeyId' => 'SEi7HOeAkFGAg2gl',
'AccessKeySecret' => 'r7zdnBMjGwxqU90DDDlYqW3UT2AX9X',
'timezone' => 'Asia/Shanghai',
目测配置没什么不对的,能帮我看一下吗?
2015-10-28 18:59
刚刚又去https://github.com/johnlui/AliyunOSS/blob/master/OSSExample.php更新了一下,OSSExample也重修改过了,还是这样的。
另外, 'ossServer' , 'ossServerInternal','AccessKeyId', 'AccessKeySecret' 的配置与'timezone'配置在同一层次的。
2015-10-29 10:51
$oss = new OSS(true);
这是选择采用内网传输。如果你都是外网使用,可以改成false或者不传参数。
2015-10-29 13:07
2015-10-29 16:10
然后尝试OSS::getAllObjectKey('×××')仍旧报错“Key [Endpoint] was not set.”
2015-10-29 17:02
======================= 我是分割线 ===========================
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Shanghai',
'ossServer' => 'http://oss-cn-beijing.aliyuncs.com', //青岛为 http://oss-cn-qingdao.aliyuncs.com
'ossServerInternal' => 'http://oss-cn-beijing-internal.aliyuncs.com', //青岛为 http://oss-cn-qingdao-internal.aliyuncs.com
'AccessKeyId' => 'SEi7HOeAkFGAg2gl',
'AccessKeySecret' => 'r7zdnBMjGwxqU90DDDlYqW3UT2AX9X',
2015-08-13 18:25
有没有移动和 删除方法? 比如我有多个bucket 能有方法进入某个buchket不?????
2015-07-30 09:28
2015-06-27 16:29
public static function buildResourcePath($key) {
return empty($key) ? '/' : '/'.$key;
}
这个方法,把$key的url序列化去了,上传的$key可以指定目录了。当然,services里面的oss,的上传路径最好是检查下是否为绝对路径,如果是绝对路径把前面的'/'去了,因为这方法里面会自动增加。
2015-06-23 10:35
看了下这个包的实现,oss/src/Aliyun目录下的源文件中,显示的是
2 /**
3 * Copyright (C) Alibaba Cloud Computing
4 * All rights reserved.
5 *
6 * 版权所有 (C)阿里云计算有限公司
7 */
但是翻了下官方文档 http://docs.aliyun.com/?spm=5176.383663.9.2.Wdtb0x#/pub/oss/sdk/sdk-download&php
提供的sdk与 johnlui/AliyunOSS 中封装的方式完全不一样呀
oss/src/Aliyun下的源文件是自己开发的还是 从哪里Get到的?
多谢:)
2015-06-03 13:14
The specified bucket is not valid.
所有参数都没问题,bucket名称也100%没写错,因为是复制过去的
2015-05-13 18:01
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The scheme of endpoint is not set.' in /Users/sluin/Downloads/AliyunOSS-master/oss/src/Aliyun/Common/Communication/HttpRequest.php:76
code:
<?php
require_once('./OSS.php');
OSS::upload('zheshiyigetest', '/Users/sluin/Downloads/AliyunOSS-master/test.png');
?>
报错看不太懂....不知道怎么修改
2015-05-13 11:49
example中 use JohnLui\AliyunOSS\AliyunOSS; 这里 是两个AliyunOSS 吗 ? 我在另一个文件中只看到 namespace了一个JohnLui\AliyunOSS .
另外 , 刚学我都没有科普,不知道怎么用框架, 是不是要自己写一个Config类 ? 因为没有找到这个在哪里声明过 .谢谢了 .
2015-05-07 10:36
2015-02-11 21:13
ssage":"Class 'Aliyun\\OSS\\OSSClient' not found","file":"E:\\work\\php\\Apache2
4\\htdocs\\shop\\app\\controllers\\OSS.php","line":13}}
我也查看了vendor/composer
/vendor/composer/autoload_psr4.php 中有 'JohnLui\\AliyunOSS\\' => array($vendorDir . '/johnlui/aliyun-oss'), 这样行
2015-02-06 09:14
1. config.json 中我添加了require和classmap
2. 执行了composer update 和 composer dump-autoload
3. 之后查看了配置文件,信息都是正确的。
但是总是提示":Class 'JohnLui\AliyunOSS\AliyunOSS' not found
2015-02-06 10:45
2015-02-06 19:39
Cannot redeclare class JohnLui\AliyunOSS\AliyunOSS
2015-02-09 16:05
2018-01-05 13:53
2023-05-26 10:05
请问laravel8 php8 上传的时候返回 Invalid handle provided 是啥问题 文件都是正常的 是不是curl请求的问题 guzzle 版本太低导致。 忘大佬帮忙看看 感谢