Home > Backend Development > PHP Tutorial > php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入

php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入

WBOY
Release: 2016-06-23 13:46:01
Original
1125 people have browsed it

php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入memcahe,然后再取出memcahe里的验证码进行检校。小白求指点


回复讨论(解决方案)

这里比较详细 Memcache基础教程

/* OO API */$memcache_obj  = new  Memcache ;/* connect to memcached server */$memcache_obj -> connect ( 'memcache_host' ,  11211 );/*设置'var_key'对应值,使用即时压缩失效时间为50秒*/$memcache_obj -> set ( 'var_key' ,  'some really big variable' ,  MEMCACHE_COMPRESSED ,  50 );echo  $memcache_obj -> get ( 'var_key' );
Copy after login


http://blog.csdn.net/fdipzone/article/details/7166514

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template