__call()和call_user_func_array()
作者:
幻无虚生 | 来源:发表于
2019-07-20 16:23 被阅读0次<?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');
本文标题:__call()和call_user_func_array()
本文链接:https://www.haomeiwen.com/subject/dzjulctx.html
网友评论