1
有没有办法将我将在函数中使用的参数保存到变量中?如何将函数参数保存到PHP中的变量中
例如,如果一个函数要求:
function foo($string, $callback_function) {
//
}
我如何保存
$arguments = $string, $callback()
,这样我可以
foo($arguments)
这可能吗?怎么样?这个方法叫什么?
非常感谢您
还有没有其他的方法?因为函数是类的一个方法 'Model :: blah() - > foo($ arguments);' ? –
你可以调用类的静态方法,如下所示: 'call_user_func_array('Model :: blah',$ arguments);' 通过传递一个数组:'call_user_func_array(array($ model,'blah'), $参数);' – Theo