小智 5
这是一个简单的例子
rule locations is active {
select using ".*" setting ()
pre {
whereareyou = location:region();
msg = <<
#{whereareyou}
>>;
}
notify("I think you live in", msg) with sticky = true;
}
Run Code Online (Sandbox Code Playgroud)
这是文档. http://docs.kynetx.com/docs/Location
您会发现的问题是,有时ip并不真正代表用户的真实位置,因为用户可能正在使用代理.此外,对于大多数ISP,ip被注册到一个位置,而ISP的中心不是在任何给定时刻使用IP的直接位置.
随着浏览器中html 5和位置apis的出现,未来可以提供更准确的位置,但尚未在KRL中实现.
归档时间: |
|
查看次数: |
93 次 |
最近记录: |