I use lumen to make the API excuse, the URL is static, similar to this:
Https://www.foo.com/api/v1/ar ...
The ID here is the required parameter.
But when I call this interface, the pass-through parameter uses this URL format:
Https://www.foo.com/api/v1/ar ...
Can I change the URL format to support directly in Laravel or lumen? The form of a query?
Or in the Nginx rewrite method rewrite to achieve, specifically how to re?
Thank you!!
Reply content:
I use lumen to make the API excuse, the URL is static, similar to this:
Https://www.foo.com/api/v1/ar ...
The ID here is the required parameter.
But when I call this interface, the pass-through parameter uses this URL format:
Https://www.foo.com/api/v1/ar ...
Can I change the URL format to support directly in Laravel or lumen? The form of a query?
Or in the Nginx rewrite method rewrite to achieve, specifically how to re?
Thank you!!
This does not require a URL rewrite route
Route::any('api/v1/article', function(Request $request){ $id = $request->input('id'); if (empty($id)) return 'parameter "id" invalid. '; return redirect('api/v1/article/'.$id);})Route::any('api/v1/article/{id}', 'ArticleController@index');
Thank you for your invitation.
https://laravel-china.org/topics/688
The routing is set up a bit.