1.設置應用配置文件config.php
type可以是很多分類File、redis等等。
立即學習“PHP免費學習筆記(深入)”;
相關推薦:《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->get('name'); ????????$this->assign('data',$data); ????????return?view(); ????} }
3.前端顯示
新建application/index/view/index.html
nbsp;html> ????<meta> ????<title>index/index</title> ????{$data}
輸出:
klc123
PS:使用redis,注意開啟redis服務器。
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦