标签:redis
<?php namespace Illuminate\Redis; use Illuminate\Support\ServiceProvider; // this namespace class RedisServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = true;// a instance of Service Provider // a Redis Service Provider // Indicates if loading of the provider is deferred. /** * Register the service provider. * * @return void */ public function register() { $this->app->singleton(‘redis‘, function ($app) { return new Database($app[‘config‘][‘database.redis‘]); }); }//Register the service provider // a good redis register // one parameter is redis // other is a Database class /** * Get the services provided by the provider. * * @return array */ public function provides() { return [‘redis‘]; }// a big redis //Get the services provided by the provider }
本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1829002
[李景山php]每天laravel-20160922|RedisServicProvider.php
标签:redis
原文地址:http://jingshanls.blog.51cto.com/3357095/1829002