如何使用ThinkPHP框架中的Redis功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计206个文字,预计阅读时间需要1分钟。
在编程中,`type`可以代表多种类型,如File、Redis等。
1.设置应用配置文件config.php
type可以是很多分类File、Redis等等。
立即学习“PHP免费学习笔记(深入)”;
相关推荐:《ThinkPHP教程》
2.thinkphp5使用redis
新建application/index/controller/index.php
<?php namespace app\index\controller; use think\Controller; use think\Cache; class Index extends Controller { public function index() { $han = new Cache; // halt($han); $han->set('name','klc123'); $data = $han->get('name'); $this->assign('data',$data); return view(); } }
3.前端显示
新建application/index/view/index.html
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>index/index</title> </head> <body> {$data} </body> </html>
输出:
klc123
PS:使用redis,注意开启redis服务器。
本文共计206个文字,预计阅读时间需要1分钟。
在编程中,`type`可以代表多种类型,如File、Redis等。
1.设置应用配置文件config.php
type可以是很多分类File、Redis等等。
立即学习“PHP免费学习笔记(深入)”;
相关推荐:《ThinkPHP教程》
2.thinkphp5使用redis
新建application/index/controller/index.php
<?php namespace app\index\controller; use think\Controller; use think\Cache; class Index extends Controller { public function index() { $han = new Cache; // halt($han); $han->set('name','klc123'); $data = $han->get('name'); $this->assign('data',$data); return view(); } }
3.前端显示
新建application/index/view/index.html
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>index/index</title> </head> <body> {$data} </body> </html>
输出:
klc123
PS:使用redis,注意开启redis服务器。

