Skip to content

新版qiniu/php-sdk v7.3.0删除资源返回结果与v7.2.10不兼容导致程序出错 #350

New issue

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

Closed
aoyoo111 opened this issue Oct 2, 2020 · 2 comments

Comments

@aoyoo111
Copy link

aoyoo111 commented Oct 2, 2020

新版qiniu/php-sdk v7.3.0删除资源返回结果与v7.2.10不兼容:
$res = $bucketManager->delete($config['bucket'], $file);
v7.3.0版删除资源后返回数组
array(2) { [0] => NULL [1] => NULL }
v7.2.10版删除资源后返回
NULL

1.使用如下判断存在错误
if (!is_null($res) || $res !== null) { return [ 'data'=> '删除qiniu文件失败', 'status'=> false ]; } else { return [ 'data'=> '删除成功', 'status'=> true ]; }
2. 请问v7.3.0版返回的数组下标0和1分别表示什么?该如何判断是否删除成功,谢谢

@timhbw
Copy link
Contributor

timhbw commented Oct 10, 2020

  • 新版本把方法的返回值统一为数组形式了
  • 放到数组里面就可以了,判断语句不用变,比如:
list($ret, $err) = $bucketManager->delete($bucket, $key);
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);

@aoyoo111
Copy link
Author

@timhbw 感谢回复,我试一下看看!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants