Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP从函数名获取参数_Php_Laravel_Eloquent - Fatal编程技术网

PHP从函数名获取参数

PHP从函数名获取参数,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

我想创建一个函数,如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_user_func([$this, 'where'], array_merge(substr($name, 5), $value));
   } else {
      parent::__call($name, $value);
   }
}

我认为你的欲望是一个坏的欲望=

请看向我们展示你的努力,我是说你的代码?