subscribe
该静态类用于绑定lua文件与请求路径
引用:require("fastweb.subscribe")
方法概览
| 返回值 | 方法及描述 |
|---|---|
bool |
add(pattern, filepath)增加订阅规则 |
bool |
remove(pattern)移除订阅规则 |
bool |
exist(pattern)是否存在订阅规则 |
void |
clear()清空订阅器 |
方法详细
add(pattern, filepath)
| 描述 | 增加订阅规则。 |
| 参数 | pattern (string): 规则表达式。filepath (string): lua路径,网站目录为根目录。 |
| 返回值 | bool |
示例:
subscribe.add("/user/*", "/api/user.lua")
exist(pattern)
| 描述 | 是否存在订阅规则。 |
| 参数 | pattern (string): 规则表达式。 |
| 返回值 | bool |
remove(pattern)
| 描述 | 移除订阅规则。 |
| 参数 | pattern (string): 规则表达式。 |
| 返回值 | bool: 存在且删除返回true,不存在返回false。 |
clear()
| 描述 | 清空订阅器。 |
| 参数 | 无。 |
| 返回值 | 无。 |