In Laravel, how can I get *only* POST parameters?

二次信任 提交于 2019-12-01 02:26:06

In the class Illuminate\Http\Request (or actually the Symphony class it extends from Symfony\Component\HttpFoundation\Request) there are two class variables that store request parameters.

public $query - for GET parameters

public $request - for POST parameters

Both are an instance of Symfony\Component\HttpFoundation\ParameterBag which implements a get method.

Here's what you can do (although it's not very pretty)

$request = Request::instance();
$request->request->get('my_param');

Why trying to complicate things when you can do easily what you need :

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