|
一、直接调用方法
[U]复制代码[/U] 代码如下:
function test($a, $b)
{
echo '测试一:'.$a.$b;
}
//调用test方法,array("asp", 'php')对应相应的参数
call_user_func_array('test', array("asp", 'php'));
二、通过类调用类中的方法
[U]复制代码[/U] 代码如下:
class test2{
function phpSay($a, $b)
{
echo '测试二:'.$a.$b;
}
}
$o = new test2();
//相当于:$o->phpSay('php','你好');
call_user_func_array(array(&$o, 'phpSay'), array('php','你好'));
您可能感兴趣的文章:php自定义函数call_user_func和call_user_func_array详解PHP中call_user_func_array()函数的用法演示PHP 的异常处理、错误的抛出及回调函数等面向对象的错误处理方法PHP 使用MySQL管理Session的回调函数详解PHP 函数call_user_func和call_user_func_array用法详解PHP将回调函数作用到给定数组单元的方法ThinkPHP自动完成中使用函数与回调方法实例PHP实现通过正则表达式替换回调的内容标签php微信浏览器分享设置以及回调详解PHP中call_user_func_array回调函数的用法示例
|
|