时间:2021-07-01 10:21:17 帮助过:10人阅读
代码如下,代码为memcache官方代码,引用在此,做一下简单的说明:
1、设置用户名和密码
define('ADMIN_USERNAME','admin'); // Admin Username
define('ADMIN_PASSWORD','123456'); // Admin Password
2、配置服务器及其端口,可以配置多台
$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'localhost:11212'; // add more as an array
| +----------------------------------------------------------------------+*/$VERSION='$Id: memcache.php,v 1.1.2.3 2008/08/28 18:07:54 mikl Exp $';define('ADMIN_USERNAME','admin'); // Admin Usernamedefine('ADMIN_PASSWORD','123456'); // Admin Passworddefine('DATE_FORMAT','Y/m/d H:i:s');define('GRAPH_SIZE',200);define('MAX_ITEM_DUMP',50);$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array////////// END OF DEFAULT CONFIG AREA ////////////////////////////////////////////////////////////////////////////// Password protect ////////////////////////////////////////////////////////////////if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME ||$_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { Header("WWW-Authenticate: Basic realm=\"Memcache Login\""); Header("HTTP/1.0 401 Unauthorized"); echo <<Rejected!
Wrong Username or Password!