您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

thinkphp redis用法是什么

2024/5/16 8:29:28发布27次查看
thinkphp5如何使用redis?
1.设置应用配置文件config.php
type可以是很多分类file、redis等等。
相关推荐:《thinkphp教程》
2.thinkphp5使用redis
新建application/index/controller/index.php
<?phpnamespace 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服务器。
以上就是thinkphp redis用法是什么的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product