0

我没有找到任何与Lumen(不是 Laravel)相关的东西来将值传递给控制器​​。我的方法是错误的还是我只是错过了显而易见的事情?

我想将参数传递给控制器​​,而不是谈论{name}in localhost:8000/someprefix/{name}。由于 lumen 正在使用FastRoute,我不想改回默认路由器。我想将值作为方法参数传递给控制器​​?任何帮助将不胜感激。

网页.php

// $value has the method
// I want to pass the $myParameter value to below mentioned statement ?
// and receive it as parameter in **methodNotAllowedHere()** in the controller
$myParameter = 10;
$router->addRoute($value, '/signup', 'UserController@methodNotAllowedHere');

用户控制器.php

// i want to receive $myParameter as  $value 
public function methodNotAllowedHere( $value = '' ) {
    return $value;
}
4

0 回答 0