Php 如何包装接受无限个参数的函数
我想包装一个接受无限个参数的现有函数, e、 g.这是现有的功能:Php 如何包装接受无限个参数的函数,php,argument-passing,Php,Argument Passing,我想包装一个接受无限个参数的现有函数, e、 g.这是现有的功能: function T() { $args = func_num_args(); // Do stuff with arguments. } 我现在想把它包起来 /* * This function shall also take unlimited arguments, * and just pass them on to T(). */ function myT() { // TODO: Tak
function T()
{
$args = func_num_args();
// Do stuff with arguments.
}
我现在想把它包起来
/*
* This function shall also take unlimited arguments,
* and just pass them on to T().
*/
function myT()
{
// TODO: Take all arguments and pass them on to T().
$result = T();
// Do stuff with the result of T().
}
但是,我不知道如何将无限参数传递给
myT()
中的T()
使用call\u user\u func\u array()
()
$res = call_user_func_array("T", func_get_args());