# 来自路由参数

另一种获取URL数据的主要方法是从路由参数中获取数据，这些参数被注入到为当前路由服务的控制器方法或闭包中，如示例7-9所示。

{% code title="Example 7-9. Getting URL details from route parameters" %}

```php
// routes/web.php
Route::get('users/{id}', function ($id) {
    // If the user visits myapp.com/users/15/, $id will equal 15
});
```

{% endcode %}

学习更多路由和路由绑定,请查看第三章


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liseen315.gitbook.io/laravel/shou-ji-he-chu-li-yong-hu-shu-ju/lu-you-shu-ju/lai-zi-lu-you-can-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
