<?php
class Index{
public function price($day,$price){
echo "出去旅游".$day."天,总共用了".$price.'元';
}
}
class Travel{
public $price;
public function index(){
}
public function __construct()
{
$this->price=new Index();
}
public function __call($pub,$age){
if(method_exists($this->price,$pub)){
call_user_func_array([$this->price,$pub],$age);
}
}
}
$travle=new Travel();
$travle->price('10','10000');
网友评论