For example, when you want to call an interface, the service addresses of many interfaces are the same, but they are executed by their respective classes and methods. If you want to encapsulate, you cannot determine the parameter type and number. For example, $className is your specific one. Class, $actionName is the method executed in the class
In this way, it is difficult for you to handle various parameters in one place. The convenient thing is that when writing the specific call interface, the parameters are passed according to the rules, but the actual call and return are uniformly transmitted by $params. Although PHP is of the same type, the interface you call may be written in other static languages, and the type must be consistent.
Of course, if you only use it once, you can just pass the variable directly, no need to bother.
The meaning is that you don’t need to declare an array separately
You can understand it as syntax sugar
func_get_args
It can be implemented, but sometimes it is not so elegantFor example, when you want to call an interface, the service addresses of many interfaces are the same, but they are executed by their respective classes and methods. If you want to encapsulate, you cannot determine the parameter type and number. For example, $className is your specific one. Class, $actionName is the method executed in the class
In this way, it is difficult for you to handle various parameters in one place. The convenient thing is that when writing the specific call interface, the parameters are passed according to the rules, but the actual call and return are uniformly transmitted by $params. Although PHP is of the same type, the interface you call may be written in other static languages, and the type must be consistent.
Of course, if you only use it once, you can just pass the variable directly, no need to bother.
redis.lpush
sceneIt’s just syntactic sugar, with variable parameters. Many languages have implemented it, and PHP has also implemented it