call_user_func_array函数
http://php.net/manual/zh/function.call-user-func-array.php
感觉用这种方法来调用函数或者对象的方法很有逼格啊
call_user_func_array — 调用回调函数,并把一个数组参数作为回调函数的参数
<?php function foobar($arg, $arg2) { echo __FUNCTION__, " got $arg and $arg2 <br>"; } call_user_func_array("foobar", array("one", "two"));
输出结果: foobar got one and two
<?php class foo { function bar($arg, $arg2) { echo __METHOD__, " got $arg and $arg2<br>"; } } // Call the $foo->bar() method with 2 arguments $foo = new foo; call_user_func_array(array($foo, "bar"), array("three", "four"));
输出结果: foo::bar got three and four