Lumen Class Route Not found

扶醉桌前 提交于 2020-01-05 06:27:52

问题


I am trying to implement the code stated in Laracast.

$proxy = Request::create(
        '/oauth/token',
        'POST'
    );

    return Route::dispatch($proxy);

This gives me error Class Route Not found.My question is how can we use Route:dispatch() in lumen ? Thanks


回答1:


Lumen 5.4

global $app;    

$proxy = Request::create(
    '/oauth/token',
    'post',
    [
        'grant_type'=>$grant_type,
        'client_id'=>$client_id,
        'client_secret'=>$client_secret,
        'username'=>$username,
        'password'=>$password
    ]

);

return $app->dispatch($proxy);



回答2:


I found the solution for this problem.We can use the following code.

$proxy = Request::create(
        '/oauth/token',
        'post',
        [
            'grant_type'=>$grant_type,
            'client_id'=>$client_id,
            'client_secret'=>$client_secret,
            'username'=>$username,
            'password'=>$password
        ]

    );



    return App::dispatch($proxy);


来源:https://stackoverflow.com/questions/43038479/lumen-class-route-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!