Download the PHP package lmh/api-module without Composer
On this page you can find all versions of the php package lmh/api-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package api-module
apiModule
执行如下SQL语句
部署说明
可根据文档自行调整,以适用其他框架下使用 项目用到了缓存可以改成其框架下的缓存也可以直接使用该项目的缓存组件进行修改redis mysql等
请求地址及请求方式
请求地址:
/api/test
;请求方式:
POST
公共参数
参数名 | 类型 | 是否必须 | 描述 |
---|---|---|---|
app_id | string | 是 | 应用ID |
method | string | 是 | 接口名称 |
format | string | 否 | 回调格式,默认:json(目前仅支持json) |
sign_method | string | 否 | 签名类型,默认:md5(目前仅支持 md5 ,rsa) |
nonce | string | 是 | 随机字符串,长度1-32位任意字符 |
sign | string | 是 | 签名字符串,参考签名规则 |
业务参数
API调用除了必须包含公共参数外,如果API本身有业务级的参数也必须传入,每个API的业务级参数请考API文档说明。
签名规则
- 对所有API请求参数(包括公共参数和请求参数,但除去
sign
参数),根据参数名称的ASCII码表的顺序排序。如:foo=1, bar=2, foo_bar=3, foobar=4
排序后的顺序是bar=2, foo=1, foo_bar=3, foobar=4
。 - 将排序好的参数名和参数值拼装在一起,根据上面的示例得到的结果为:bar=2&foo=1&foo_ba=3&foobar=4。
- 把拼装好的字符串采用utf-8编码,使用签名算法对编码后的字节流进行摘要。如果使用
MD5
算法,则需要在拼装的字符串后加上app的secret
后,再进行摘要,如:md5(bar=2&foo=1&foo_bar=3&foobar=4+secret) - 将摘要得到的字节结果使用大写表示
返回结果
API接口命名规范(method)
接口命名规范
- 命名字母按功能或模块从大到小划分,依次编写;如后台用户修改密码:'admin.user.password.update'
- 字母最后单词为操作。查询:
get
;新增:add
;更新:update
;删除:delete
;上传:upload
;等 - 第一位是分组 案例中使用了open分组 open.xx.xx
API DEMO 示例
All versions of api-module with dependencies
PHP Build Version
Package Version
The package lmh/api-module contains the following files
Loading the files please wait ....