Home > Backend Development > PHP Tutorial > call_user_func_array这个函数,该如何处理

call_user_func_array这个函数,该如何处理

WBOY
Release: 2016-06-13 10:12:40
Original
898 people have browsed it

call_user_func_array这个函数
是不是只能使用在没有构造函数的类,比如:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->  class service {          private $self_id ;        /* 构造 */    public function __construct($a) {           /* ……            */    }    public function A($b) {    }    }
Copy after login


现在要想用call_user_func_array() 这个函数调用service类的function A() 该怎么写?构造函数的参数怎么办?

------解决方案--------------------
通常实现你这个功能会在初此类中 _call 来实现,传过一的参数不确定,但调用的参数会转化为 数组的。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template