We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码如下
$auth = new QiniuAuth( env('QINIU_ACCESS'), env('QINIU_SECRET') ); $config = new QiniuConfig(); $bucketManager = new BucketManager($auth, $config); $bucket = env('ATTACH_BUCKET'); $err = $bucketManager->delete($bucket, $key); dd($err);
删除成功返回
array:2 [ 0 => null 1 => null ]
删除失败返回
array:2 [ 0 => null 1 => Qiniu\Http\Error^ {} ]
null
Exception
Qiniu\Http\Erro
The text was updated successfully, but these errors were encountered:
@aiyuchen
第一个参数是什么意思,成功和失败都返回null
第一个参数是服务端响应的 body 信息,成功时,如果服务端没有响应任何信息则为 null,如果返回了信息则为 json 数据。
以 list($ret, $err) = $bucketManager->delete($bucket, $key); 为例,如要判断删除成功,判断 $err != null 即可。
list($ret, $err) = $bucketManager->delete($bucket, $key);
$err != null
第二个参数从字面上看是不是一个异常Exception,文档里好像没有关于Qiniu\Http\Erro说明
否,为自定义 Error 类。以 list($ret, $err) = $bucketManager->delete($bucket, $key); 为例,该 $err 实例上有如下几个方法可调用:
$err
$err -> code()
$err -> message()
$err -> getResponse()
如果还有其他疑问欢迎随时重新打开这个 issue!
Sorry, something went wrong.
No branches or pull requests
代码如下
测试了两遍,分别如下
删除成功返回
删除失败返回
null
Exception
,文档里好像没有关于Qiniu\Http\Erro
说明The text was updated successfully, but these errors were encountered: