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

PHP gets Memcached's cas_token

藏色散人
Release: 2023-04-06 12:32:01
forward
2430 people have browsed it

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

php7method

$_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 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:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template