问题
how laravel route get argument from caller function with same name
class Route{
public $urlname;
function __construct($geturl){
//get url like this $this->url=$geturl["REQUEST_URI"];
}
function get($url,/*(description=closure or require controller and get methods, but now for test)*/ $test){
if($url===$this->urlname){
//i don't know what to do here for To get the argument I want
echo $test;
}
}
function post(){
///
}
$obj=new Route($_SERVER);
$obj->get("url","index@index");
$obj->get("url","hellodear");
$obj->get("url","hisweety");
$obj->get("url","poopelephant=php");
//...
Output
index@indexhellodearhisweetypoopelephant=php
but i want output be like this
index@index
or
hellodear
or
hisweety
and also getting more arguments if the function has more arguments
/*function get($url,$test,...$morearg)*/
来源:https://stackoverflow.com/questions/58887225/php-how-to-call-many-times-of-one-function-and-get-parameter