Home >Backend Development >PHP Tutorial >PHP gets Memcached's cas_token

PHP gets Memcached's cas_token

藏色散人
藏色散人forward
2019-09-27 17:00:392205browse

php official method code

$ips = $m->get('ip_block', null, $cas);

According to the code provided by php official documentation to obtain cas_token, the result $cas is always null, after checking for a long time, it turns out that it is obtained in php5 and php7 The method of cas_token is different

php5 method

$ips = $m->get('ip_block', null, $cas);
var_dump($cas);

php7 method

$_val = $m->get('ip_block', null, Memcached::GET_EXTENDED);
var_dump($_val['cas']);

make a judgment

$cas = null;
if (defined(Memcached::GET_EXTENDED)){
    $_val = $m->get('ip_block', null, Memcached::GET_EXTENDED);
    $cas = $_val['cas'];
} else {
    $ips = $m->get('ip_block', null, $cas);
}
var_dump($cas);

Related recommendations: "PHP Video Tutorial"

The above is the detailed content of PHP gets Memcached's cas_token. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jmsite.cn. If there is any infringement, please contact admin@php.cn delete