Skip to content
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

直传回调验签 报错 Call to undefined method Iidestiny\Flysystem\Oss\OssAdapter::verify() #42

Open
zix2002 opened this issue Sep 6, 2022 · 1 comment

Comments

@zix2002
Copy link

zix2002 commented Sep 6, 2022

如题,代码如下

    public function clientUploadCallback(): JsonResponse
    {
        $aliyun = Storage::disk('aliyun')->getAdapter();
        [$verify, $data] = $aliyun->verify(); // php 7.1 +

        Log::debug('verify', [$verify]);
        Log::debug('data', [$data]);

        if ($verify) {
            // 验证失败处理,此时 $data 为验签失败提示信息
        }

        // 注意一定要返回 json 格式的字符串,因为 oss 服务器只接收 json 格式,否则给前端报 CallbackFailed
        return response()->json($data);
    }

验签是报错 Call to undefined method Iidestiny\Flysystem\Oss\OssAdapter::verify(), verify方法不存在
不知道哪里出问题了

Laravel : 8.83.17
PHP: 8.0
iidestiny/laravel-filesystem-oss: 2.1

@zotopteam
Copy link

zotopteam commented Sep 30, 2022

多半是你这个Storage::disk('aliyun')->getAdapter() 中的disk 阿里云配置不对,或者不存在这个disk

先检查一下你的config/filesystems.php,下面是否配置正确,给你一个我的示例,注意这里:'driver' => 'oss'

        'aliyun' => [
            'driver'     => 'oss',
            'root'       => '',
            'access_key' => env('OSS_ACCESS_KEY'),
            'secret_key' => env('OSS_SECRET_KEY'),
            'endpoint'   => env('OSS_ENDPOINT'),
            'bucket'     => env('OSS_BUCKET'),
            'isCName'    => env('OSS_IS_CNAME', false),
        ],

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