文件自动加载

class omnpay{
      public static function __callStatic($method, $parameters)
    {echo '调用了不存在的静态方法:'.$method.'不存在的这个方法的参数是'. implode(',', $parameters). "\n";    
    }
}
omnpay::create('aaa','bbb');
//调用了不存在的静态方法:create不存在的这个方法的参数是aaa,bbb
call_user_func_array:调用回调函数,并把一个数组参数作为回调函数的参数
function foobar($arg, $arg2) {
    echo __FUNCTION__, " 参数是 $arg and $arg2\n";
}
call_user_func_array("foobar", array("one", "two"));//输出  foobar 参数是 one and two


class foo {
    function bar($arg, $arg2) {
        echo __METHOD__, " 参数是 $arg and $arg2\n";
    }
}
$foo = new foo;
call_user_func_array(array($foo, "bar"), array("three", "four"));//输出  foo::bar 参数是 three and four

猜你喜欢

转载自www.cnblogs.com/lichihua/p/10386539.html