Heim >Backend-Entwicklung >PHP-Tutorial >请教用名称调用函数和传参
call_user_func_array 传参
会用call_user_func_array调用已知名称的函数, 但调用已实例化的类就不会了...class class_a { public $var_a = 0; public function fun_1 ( $var ) { var_dump( $this->var_a + $var ); } }; $obj_a = new class_a(); $obj_a->var_a = 6; call_user_func_array( array( 'class_a', 'fun_1' ), array( 5 ) );
class class_a { public $var_a = 0; public function fun_1 ( $var ) { var_dump( $this->var_a + $var ); } }; $obj_a = new class_a(); $obj_a->var_a = 6; call_user_func_array( array($obj_a, 'fun_1' ), array( 5 ) );
我勒个去...居然仅仅是这样...
感谢楼上解答...
怪小弟手册没深看...脑子也不会动...值得检讨