首页 > 编程知识 正文

节点精灵系列 Lua 纯源码取网络时间,lua获取网络时间

时间:2023-05-05 16:42:15 阅读:204790 作者:625

--Time: 2020年9月18日 02:15:42-- by : MemoryChobits -- QQ : 1762272313function GetMind(str,ks,over)local strchar=string.find(str,ks)if (strchar>1) thenlocal bafter=string.find(str,over,strchar+string.len(ks))if (bafter>1) thenlocal Getdata=string.sub(str,strchar+string.len(ks),bafter-1)print(Getdata);return GetDataendendreturn ""endfunction GetTime()-- 获取网页的所有数据local p={url="http://www.time163.com/";}res=httpGet(p);if res then local time = GetMind(res.body,"<header>n<time>","</time>") return time ;elseprint("获取失败") return nil ;endendGetTime()

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。