phpredis - 请问$this->getRedis()->{$func}($key)这种结构是什么意思,在php的redis操作类中找到的。

WBOY
Release: 2016-06-06 20:17:22
Original
1418 people have browsed it

<code>$this->getRedis()->{$func}($key)</code>
Copy after login
Copy after login

回复内容:

<code>$this->getRedis()->{$func}($key)</code>
Copy after login
Copy after login

<code>call_user_func([$this->getRedis(), $func], $key);
</code>
Copy after login

和这个等价的,$this->getRedis()返回的是一个拥有$func方法的对象,其参数是$key,这种写法叫做链式操作

Related labels:
source:php.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