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

PHP gets Memcached's cas_token

藏色散人
Release: 2023-04-07 13:32:02
forward
2194 people have browsed it

php official method code

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

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);
Copy after login

php7 method

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

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);
Copy after login

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!

Related labels:
source:jmsite.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template