[comment]: # translation:outdated

[comment]: # ({63f61bee-1c702cf9})
# 获取

[comment]: # ({/63f61bee-1c702cf9})

[comment]: # ({88be7749-55f8403c})
### 描述

`integer/array module.get(object parameters)`

此方法允许根据给定参数检索模块。

::: noteclassic
此方法仅适用于 *Super admin* 用户类型。
调用此方法的权限可在用户角色设置中撤销。
更多信息请参见 [用户角色](/manual/web_interface/frontend_sections/users/user_roles)。
:::

[comment]: # ({/88be7749-55f8403c})

[comment]: # ({79220f05-c81b6507})
### 参数

`(object)` 定义所需输出的参数。

该方法支持以下参数。

|参数|[类型](/manual/api/reference_commentary#data-types)|说明|
|--|--|------|
|moduleids|ID/array|仅返回具有给定 ID 的模块。|
|sortfield|string/array|按给定属性对结果进行排序。<br><br>可能的值：`moduleid`、`relative_path`。|
|countOutput|boolean|这些参数在[参考说明](/manual/api/reference_commentary#common-get-method-parameters)中进行了描述。|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/79220f05-c81b6507})

[comment]: # ({07ca11ca-46698515})
### 返回值

`(integer/array)` 返回两者其中任一：

-   一组对象数组；
-   如果已经使用了 `countOutput` 参数，则检索对象的计数。

[comment]: # ({/07ca11ca-46698515})

[comment]: # ({b41637d2-0d9fe9e7})
### 示例

[comment]: # ({/b41637d2-0d9fe9e7})

[comment]: # ({b4a4b966-8cbe68b4})
#### 通过 ID 检索模块

检索有关模块 "1"、 "2"和 "25"的所有数据。

[请求](/manual/api#performing-requests)：

```json
{
    "jsonrpc": "2.0",
    "method": "module.get",
    "params": {
        "output": "extend",
        "moduleids": [
            "1",
            "2",
            "25"
        ]
    },
    "id": 1
}
```

响应：

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "moduleid": "1",
            "id": "actionlog",
            "relative_path": "widgets/actionlog",
            "status": "1",
            "config": []
        },
        {
            "moduleid": "2",
            "id": "clock",
            "relative_path": "widgets/clock",
            "status": "1",
            "config": []
        },
        {
            "moduleid": "25",
            "id": "example",
            "relative_path": "modules/example_module",
            "status": "1",
            "config": []
        }
    ],
    "id": 1
}
```

[comment]: # ({/b4a4b966-8cbe68b4})

[comment]: # ({393f0c8a-77300f42})
### 另请参阅

-   [模块](object#module)
-   [仪表板小部件](/manual/api/reference/dashboard/object#dashboard-widget)
-   [前端模块](/manual/extensions/frontendmodules)

[comment]: # ({/393f0c8a-77300f42})

[comment]: # ({397c2807-c9c85790})
### 来源

CModule::get() in *ui/include/classes/api/services/CModule.php*。

[comment]: # ({/397c2807-c9c85790})
