Class 'Memcache' not found & PHP

前端 未结 6 1308
囚心锁ツ
囚心锁ツ 2020-12-10 01:44

I installed memcached by reading this article on Windows7 but unfortunately i keep getting error Fatal error: Class \'Memcache\' not found in D:\\xampp\\htdocs\\test\\

6条回答
  •  臣服心动
    2020-12-10 02:28

    Memcached just uses standard text interface so its possible to use it without the module.

    // connect
    $link = fsockopen($host,$port,$errno,$errst,$timeout);
    
    // set
    $data = sprintf("set %s 0 %s %s\r\n%s\r\n",
                $key,$expire,strlen($value),$value);
    fwrite($link,$data);
    $result = trim(fgets($link));
    if ($result == 'ERROR') {
        // :(
    }
    
    // get
    $data = sprintf("get %s\r\n",$key);
    fwrite($link,$data);
    $line = rtrim(fgets($link)); 
    if ($line != 'END') {
        return rtrim(fgets($link));
    }
    

提交回复
热议问题