<?php
class Test
{
protected function haha( $id, $name )
{
var_dump( $id, $name );
}
public function __call( $name, $params )
{
if( ! method_exists($this,$name) ){
throw new Exception("Call to undefined method " . get_called_class() . '->' . $name);
}
return $this->$name( ...$params );
}
public static function __callStatic( $name, $params )
{
$object = new static;
if( ! method_exists($object,$name) ){
throw new Exception("Call to undefined method " . get_called_class() .'->'. $name);
}
return $object->$name( ...$params );
}
}
( new Test )->heihei( 7, 'xiao' );
Test::heihei( 7, 'xiao' );