今天在群里面,有个叫lewis的在问call_user_func_array的用法,因为之前一直没有用过,也不能说什么,于是看一下手册,发现是这么写的: call_user_func_array (PHP 4 >= 4.0.4, PHP 5) call_user_func_array -- Call a user function given with an array of parameters Description mixed call_user_func_array ( callbac
If you need to call object and class methods in PHP < 4.0.4, the following code ought to do the trick: <?php if (!function_exists('call_user_func_array')) { function call_user_func_array($func, $args) { $argString = ''; $comm
<?phpdefine('DS','/');define('A_PATH',str_replace('\\','/',dirname(__FILE__)).DS); //01获取到主程序目录class a {public $app,$controller,$action,$class,$client;public function __construct($client){$this->client = $client;}public function execute(){ $this->
01父类抽象类 abstract.php <?phpabstract class controller_abstract{ protected $app; function __construct(& $app){ $this->app = $app;} public function exec(){ call_user_func_array(array($this->app->class,$this->app->action),array($this->
1 call_user_func 的使用 1)使用方法直接传递值 function nowamagic($a,$b){ echo $a; echo $b; } call_user_func('nowamagic', "111","222"); 2)使用类的方法 class Func{ //静态方法 static public function _func(){ $str = 'THE CLASS NAME IS '.__CLASS__.' AND CLASS STA
一.获取静态方法调用者的类名 方法一: class foo { static public function test() { var_dump(get_called_class()); } } class bar extends foo { } foo::test(); bar::test(); 输出: string(3) "foo" string(3) "bar" 方法二: class Bar { public static function test() {