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

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

WBOY
WBOYOriginal
2016-06-13 12:09:221276browse

php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入
php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入memcahe,然后再取出memcahe里的验证码进行检校。小白求指点
------解决思路----------------------
这里比较详细Memcache基础教程
------解决思路----------------------

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


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

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