The Code is as follows: publicfunction _ call ($ method, $ args) {return $ this-& gt; redis-& gt; $ method ($ args [0] [, $ args [1] [, $ args [2]...]);} how can I implement the $ this-& gt; redis-& gt; $ method () parameter list automatically generated according to $ args changes... the Code is as follows:
Public function _ call ($ method, $ args ){
Return $ this-> redis-> $ method ($ args [0] [, $ args [1] [, $ args [2]...]);
}
How can I implement the $ this-> redis-> $ method () parameter list to automatically generate function calls based on $ args changes?
Reply content:
The Code is as follows:
Public function _ call ($ method, $ args ){
Return $ this-> redis-> $ method ($ args [0] [, $ args [1] [, $ args [2]...]);
}
How can I implement the $ this-> redis-> $ method () parameter list to automatically generate function calls based on $ args changes?
Give a thought
class RedisClient { protected $_redis; public function __construct() { $this->_redis = new Redis(); } public function __call($method, $args) { call_user_func_array(array($this->_redis, $method), $args); }}
It is not the variable length parameter list.