<?php $mem = new Memcache();//实例化一个对象 $mem->connect("localhost",11211);//连接memcache服务器 $res = $mem->add('fleam','fleam123');//添加键值对 $str = $mem->get('fleam');//获取键值对 print_r ($str);