框架lumen安装配置技巧

lumen安装
  1. 安装器安装
1. composer global require "laravel/lumen-installer"
2. lumen new blog
  1. composer安装
composer create-project --prefer-dist laravel/lumen blog
服务提供者
使用缓存cache(redis缓存)
  1. 安装依赖包
composer require predis/predis 1.0.*
composer require  illuminate/redis
  1. 配置
bootstrap/app.php 文件中注册Illuminate\Redis\RedisServiceProvider
$app->register( Illuminate\Redis\RedisServiceProvider::class );
  1. 加载Eloquent/配置
3.1 只加载配置
$app->configure('database');
3.2同时加载Eloquent
$app->withEloquent();
  1. 使用门面
$app->withFacades();
  1. 使用
app('redis')->set('redisKey', 'abc123');
//门面Redis
Redis::set('redisKey', 'abc123');
  1. 默认使用predis客户端
vendor/illuminate/redis/RedisServiceProvider.php
return new RedisManager(Arr::pull($config, 'client', 'predis'), $config);

app('cache')->put('cacheKey', '123abc', 2);
//门面Cache
Cache::put('cacheKey', '123abc', 2);
lumen辅助函数位置
vendor/illuminate/support/helpers.php
lumen配置文件位置
vendor/laravel/lumen-framework/config

转载于:https://www.cnblogs.com/51fx/p/7004446.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值