Home >Backend Development >PHP Tutorial >PHP gets Memcached's cas_token
This article mainly introduces how to obtain Memcached's cas_token in PHP. I hope it will be helpful to friends in need!
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 the way to obtain cas_token is in php5 and php7 It’s a different
php5 method
$ips = $m->get('ip_block', null, $cas); var_dump($cas);
php7method
$_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 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!