> For the complete documentation index, see [llms.txt](https://liseen315.gitbook.io/laravel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liseen315.gitbook.io/laravel/shou-ji-he-chu-li-yong-hu-shu-ju/zhu-ru-yi-ge-qing-qiu-dui-xiang/usdrequest-greater-than-input.md).

# $request->input()

然而$request->all(), $request->except(), 和 $request->only()是对用户提供的完整输入数组进行操作。$request->input()只获取单个字段的值。示例7-5提供了个示例，请注意第二个值是默认值，如果用户没输入值，这样可以容错。

{% code title="Example 7-5. $request->input()" %}

```php
Route::post('post-route', function (Request $request) { 
    $userName = $request->input('name', 'Matt');
});
```

{% endcode %}
