zoukankan      html  css  js  c++  java
  • 触动精灵 alilib

    --gethtml
    function gethtml (url)
    local sz = require("sz")
    local http = require("szocket.http")
    local res, code = http.request(url);
    
    return res
    
    end
    ---------------------------------------------------------------------------
    -- r w a分别为 读 写 追加
    --write 
    function writenew(url,data)
        local  file = io.open(url, "w");
           assert(file);
           file:write(data);
           file:close();
    end
    -----------------------------------------------------------------------------
    --write append
    function writeappend(url,data)
        local  file = io.open(url, "a");
           
           file:write(data);
           file:close();
    end
    ------------------------------------------------------------------------------
    --read to table
    function read(url)
        local x = {}
    local file = io.open(url, "r");
           assert(file);
           local data = file:read(); -- 读取所有内容
           while data do
               table.insert(x,data);
               data = file:read()
           end
          file:close();
          return x 
    end
  • 相关阅读:
    9.17 HTML CSS
    9.16
    9.15
    9.14
    9.13
    9.12
    9.11
    9.10
    9.9
    9.8
  • 原文地址:https://www.cnblogs.com/aliblogs/p/5493720.html
Copyright © 2011-2022 走看看