DropboxServiceProvider.php在$ client行中抛出未定义的索引

时间:2019-03-23 06:53:35

标签: php laravel dropbox

这是我来自DropboxServiceProver.php的代码,我通过替换令牌来替换了令牌中的原始代码: 我实际上试图从spatie / flysystem实现dropbox api。 我需要的只是将文件从我的网站上载到保管箱。 请帮忙 !! 谢谢

<?php
    namespace App\Providers;

    use Storage;
    use League\Flysystem\Filesystem;
    use Illuminate\Support\ServiceProvider;
    use Spatie\Dropbox\Client as DropboxClient;
    use Spatie\FlysystemDropbox\DropboxAdapter;

  class DropboxServiceProvider extends ServiceProvider
  {
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
         Storage::extend('dropbox', function ($app, $config) {
            $client = new DropboxClient(
                $config['authorizationToken']
            );

            return new Filesystem(new DropboxAdapter($client));
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

它返回错误为:

  

未定义索引:('authorizationToken')

我的控制器:

public function dropboxFileUpload(Request $request)
{


    $file = $request->input('file');
    Storage::disk('dropbox')->put('file.txt', 'Hello laravel ');


return view('users/order-status')->with('file',$file);

}

Filesystems.php

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
    ],

    'dropbox' => [
        'driver' => 'dropbox',
        'app_secret' => env('this_is_app_secret'),
        'token' => env('This_is_token'),
    ],

],

如何解决这个问题?

0 个答案:

没有答案