thinkphp redis用法是什么

thinkphp redis用法是什么

thinkphp5如何使用redis

1.設置應用配置文件config.php

thinkphp redis用法是什么

type可以是很多分類File、redis等等。

立即學習PHP免費學習筆記(深入)”;

thinkphp redis用法是什么

相關推薦:《ThinkPHP教程

2.thinkphp5使用redis

新建application/index/controller/index.php

<?php namespace appindexcontroller; use thinkController; use thinkCache; class Index extends Controller {     public function index()     {             $han = new Cache;         // halt($han);         $han->set('name','klc123'); ????????$data?=?$han-&gt;get('name'); ????????$this-&gt;assign('data',$data); ????????return?view(); ????} }

3.前端顯示

新建application/index/view/index.html

nbsp;html&gt;   ????<meta> ????<title>index/index</title> ????{$data}  

輸出:

klc123

PS:使用redis,注意開啟redis服務器。

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊14 分享