1

How can the WP function add_action receive another function as its argument? I know this by itself is not possible in php (to have custom functions receive other functions as arguments). I deliberately broke some code and found that there is actually a native php function call_user_fun_array beneath this (i think),

but how did they make it so that their own function can have a function as its argument?

4

1 回答 1

0

有一个原生 PHP 函数call_user_func()看看这个非常简单的例子。

function caller($custom_func){
return call_user_func($custom_func);
}
function make_echo(){
echo 'something';
}

caller('make_echo');
于 2013-11-06T19:27:08.260 回答