Home>Article>PHP Framework> How thinkphp uses redis

How thinkphp uses redis

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-08-22 16:09:37 14745browse

How thinkphp uses redis

How to use redis in thinkphp5?

1. Set the application configuration file config.php

How thinkphp uses redis

type can be many categories: File, Redis, etc.

How thinkphp uses redis

Related recommendations: "ThinkPHP Tutorial"

2.thinkphp5 uses redis

New application/index/ controller/index.php

set('name','klc123'); $data = $han->get('name'); $this->assign('data',$data); return view(); } }

3. Front-end display

New application/index/view/index.html

    index/index 
{$data}

Output:

klc123

PS: When using redis, be sure to enable the redis server.

The above is the detailed content of How thinkphp uses redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn