<?php
/**
* Created by PhpStorm.
* User: 27394
* Date: 2017/5/9
* Time: 15:26
*/
function demo($a,$b){
var_dump($a,$b);
}
call_user_func_array('demo',[1,2]);
class User{
public function demo($a,$b){
var_dump($a,$b);
}
}
$u = new User();
call_user_func_array(array($u,'demo'),[1,3]);
class Team{
public function demo($a,$b){
var_dump($a,$b);
}
public function factory(){
$arg = func_get_args();
call_user_func_array(array(__CLASS__,'demo'),$arg);
}
}
$t = new Team();
$t->factory(1,2);
[李景山php] php中call_user_func_array 的使用
最新推荐文章于 2024-08-26 23:11:41 发布