内容简介:在Laravel版本5.3之前是存在隐式控制器的处理的,但是在其之后被移除了,详情可以这里我们使用的PHP版本为7.3,而要安装的Laravel版本为5.3。首先是配置数据源,以便解决依赖问题:之后我们创建1个blog的项目:
在 Laravel 版本5.3之前是存在隐式控制器的处理的,但是在其之后被移除了,详情可以 参考 。
这里我们使用的 PHP 版本为7.3,而要安装的Laravel版本为5.3。首先是配置数据源,以便解决依赖问题:
composer config repo.packagist composer https://packagist.phpcomposer.com
之后我们创建1个blog的项目:
composer create-project --prefer-dist laravel/laravel blog "5.3.*"
这里我们指定其版本为 5.3.x
,具体版本视数据源而定。
为了避免出现类似如下的异常:
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
我们需要运行运行的命令生成秘钥:
php artisan key:generate
之后我们添加predis以便进行 redis 的操作:
composer require predis/predis
接下来我们创建1个控制器:
php artisan make:controller IndexController Controller created successfully.
在 app/Http/Controllers
目录下对 IndexController.php
进行如下的修改:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
class IndexController extends Controller
{
public function index($name){
echo Redis::get($name);
return '<br>1111</br>';
}
}
我们引入Redis类,之后就可以调用其一些方法进行操作。
最后是路由的配置,对 routes/web.php
文件进行如下的修改:
Route::get("hello/{name}","IndexController@index");
这样当我们访问 hello/xxx
,就会把xxx作为redis的键传入。
以上所述就是小编给大家介绍的《Laravel-redis处理》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 自然语言处理之数据预处理
- Python数据处理(二):处理 Excel 数据
- 什么是自然语处理,自然语言处理主要有什么
- 集群故障处理之处理思路以及健康状态检查(三十二)
- Spark 持续流处理和微批处理的对比
- Android(Java)日期和时间处理完全解析——使用Gson和Joda-Time优雅地处理日常开发中关于时间处理的...
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Pattern Recognition and Machine Learning
Christopher Bishop / Springer / 2007-10-1 / USD 94.95
The dramatic growth in practical applications for machine learning over the last ten years has been accompanied by many important developments in the underlying algorithms and techniques. For example,......一起来看看 《Pattern Recognition and Machine Learning》 这本书的介绍吧!