zoukankan      html  css  js  c++  java
  • thinkphp5使用redis

    1.设置应用配置文件config.php

    type可以是很多分类File、Redis等等



    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 lang="en">
    <head>
        <meta charset="UTF-8">
        <title>index/index</title>
    </head>
    <body>
        {$data}
    </body>
    </html>

    输出klc123

    PS:使用redis,注意开启redis服务器

  • 相关阅读:
    table
    html <input>
    html基本结构
    Spark join连接
    combineByKey
    scala mkstring
    countByValue
    spark aggregate
    scala flatmap、reduceByKey、groupByKey
    生态圈安装
  • 原文地址:https://www.cnblogs.com/konglingxi/p/9070331.html
Copyright © 2011-2022 走看看