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

laravel5.5接入,上传图片到七牛云报错了 #52

Open
330132662 opened this issue Jun 15, 2018 · 3 comments
Open

laravel5.5接入,上传图片到七牛云报错了 #52

330132662 opened this issue Jun 15, 2018 · 3 comments

Comments

@330132662
Copy link

报错:

ErrorException: Trying to get property of non-object in file /home/vagrant/code/taoshu/vendor/qiniu/php-sdk/src/Qiniu/Config.php on line 44
Stack trace:
  1. ErrorException->() /home/vagrant/code/taoshu/vendor/qiniu/php-sdk/src/Qiniu/Config.php:44
  2. Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() /home/vagrant/code/taoshu/vendor/qiniu/php-sdk/src/Qiniu/Config.php:44
  3. Qiniu\Config->getUpHost() /home/vagrant/code/taoshu/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php:58

报错位置代码:

public function getUpHost($accessKey, $bucket)
    {
        $zone = $this->getZone($accessKey, $bucket);
        if ($this->useHTTPS === true) {
            $scheme = "https://";
        } else {
            $scheme = "http://";
        }

        $host = $zone->srcUpHosts[0];// 这就是第44行了~
        if ($this->useCdnDomains === true) {
            $host = $zone->cdnUpHosts[0];
        }

        return $scheme . $host;
    }
@330132662
Copy link
Author

补充:

//七牛配置,若mode='qiniu',以下为必填.
        'qiniu' => [
            'accessKey' => 'SVr78LLP090RmTTqEm2&********',
            'secretKey' => 'D4ZdNo_7pHfzNTQufY*******',
            'bucket' => '', 
            'url' => 'http://********.com1.z0.glb.clouddn.com',//七牛分配的CDN域名,注意带上http://

这是配置页,里面的bucket我找不到在哪儿 是不是因为这个没填呢?

@vtanrun
Copy link

vtanrun commented Jul 24, 2018

登陆七牛云控制台不就能找到bucket么? 没有这个 bucket 好像生成不了正确的七牛up token

@yushengbuilder
Copy link

同样的报错,还没有解决

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

3 participants