class maomaomao
{
function maomao($count)
{
for($i=0;$i<$count;$i++)
{
echo "Hello World\n";
}
return "叫了".$count."次";
}
}
class HelloWorldDelegator
{
function __construct()
{
$this->obj=new maomaomao();
}
function __call($method,$args)
{
return call_user_func_array(array($this->obj,$method), $args);
}
private $obj;
}
$obj=new HelloWorldDelegator();
// print $obj->display(2);
print $obj->maomao(2);
__call方法的使用
最新推荐文章于 2024-01-11 22:16:52 发布