获取国家列表
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\CountryModel::countryList |
| 所属业务 | 公共接口 |
| 来源模块/系统 | 国家模型 |
功能说明
获取国家列表,包括国家名,中文名,区号
调用示例
$param = ['keywords' => '示例关键字'];
$result = (new \app\common\model\CountryModel())->countryList($param);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
param.keywords | string | 否 | — | — | 关键字 |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
list | array | 国家列表 |
list[].name | string | 国家名 |
list[].name_zh | string | 中文名 |
list[].phone_code | int | 区号 |
list[].iso | string | 国家英文缩写 |
count | int | 国家总数 |
正常返回
{
"list": [
{
"name": "示例名称",
"name_zh": "示例名称",
"phone_code": 86,
"iso": "string"
}
],
"count": 1
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |