Lumen route error handleDispatcherResponse (array ('0'))

Below is my route in clearance.

$app->get('contact-us/{msg?}', function (){
    echo Input::all();
});

It gives the following error.

at Application->handleDispatcherResponse(array('0')) in Application.php line 1184
at Application->Laravel\Lumen\{closure}() in Application.php line 1414
at Application->sendThroughPipeline(array(), object(Closure)) in Application.php line 1185
at Application->dispatch(object(Request)) in Application.php line 1125
at Application->run(object(Request)) in index.php line 31

I want to pass an optional parameter to the controller. How to convey this? msg

+4
source share
3 answers

In public / index.php do the following:

//$app->run();
$app->run($app->make('request'));
+1
source

It seems that the rules for rewriting your Apacheor Nginxsever are incorrectly configured, so Lumen cannot parse the URL correctly. If you use Nginx, use this configuration:

index  index.html index.htm index.php;
location @rewrite {
    rewrite ^/(.*)$ /index.php;
}   
location / {
    try_files $uri $uri/ @rewrite;
}

And the routes should start with /:

$app->get('/contact-us/{msg?}', function () {
    echo Input::all();
});

, RoutesRequests.php, .

0

,

$app->get('contact-us/{msg?}', 'YourController@mehtod');

And in your controller you will also receive data

public function method($message)
{

}
-1
source

Source: https://habr.com/ru/post/1605803/


All Articles