> 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/rong-qi.md).

# 容器

Laravel的服务容器或依赖注入容器是几乎所有其他功能的核心。 容器是一个简单的工具，可用于绑定和解析类和接口的具体实例，同时它是相互依赖关系强大而细致的管理器。 在本章中，您将了解有关它的内容，工作原理以及如何使用它的更多信息。

> 名称与容器
>
> 你可能注意到本书，文档，或者其他教育资源对容器使用了相当多的名称，其中包括：
>
> 1. 应用程序容器
> 2. IoC(控制反转)容器
> 3. 服务器容器
> 4. DI(依赖注入)容器
>
> 所有这些都是有用和有效的，但要知道它们都在谈论同一件事。它们都是指服务容器。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://liseen315.gitbook.io/laravel/rong-qi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
