all_user_func()详解

来源:https://blog.csdn.net/moliyiran/article/details/83514495

call_user_func — 把第一个参数作为回调函数调用

通过函数的方式回调

<?php 
function barber($type){
    echo "you wanted a $type haircut, no problem\n";
}
call_user_func('barber','mushroom');
?>

返回内容如下:
you wanted a mushroom haircut, no problem

通过类名、对象的方式回调

猜你喜欢

转载自www.cnblogs.com/laijinquan/p/11925428.html