PHP从函数名获取参数
我想创建一个函数,如laravel中的eloquent,该函数根据名称确定参数,例如whereName whereDressePHP从函数名获取参数,php,laravel,eloquent,Php,Laravel,Eloquent,我想创建一个函数,如laravel中的eloquent,该函数根据名称确定参数,例如whereName whereDresse 我怎样才能做到这一点,谢谢你你需要编辑雄辩的魔术方法uu调用如下: public function __call($name, $value) { if (substr($name, 0, 5) == 'where') { $this->where(substr($name, 5), $value); //or try call_us
我怎样才能做到这一点,谢谢你你需要编辑雄辩的魔术方法uu调用如下:
public function __call($name, $value)
{
if (substr($name, 0, 5) == 'where') {
$this->where(substr($name, 5), $value);
//or try call_user_func([$this, 'where'], array_merge(substr($name, 5), $value));
} else {
parent::__call($name, $value);
}
}
我认为你的欲望是一个坏的欲望=请看向我们展示你的努力,我是说你的代码?