当前位置:Gxlcms > PHP教程 > php怎么用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入

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

时间:2021-07-01 10:21:17 帮助过:2人阅读

php如何用memcahe缓存。写的接口,没法用session。做短信验证码的时候,把验证码存入
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' );


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

人气教程排行