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

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

WBOY
WBOYOriginal
2016-06-06 20:17:221433browse

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

回复内容:

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

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

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

Statement:
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