zoukankan      html  css  js  c++  java
  • day3 作业

        文件操作用户很广泛,我们经常对文件进行操作:

       

    global       
            log 127.0.0.1 local2
            daemon
            maxconn 256
            log 127.0.0.1 local2 info
    defaults
            log global
            mode http
            timeout connect 5000ms
            timeout client 50000ms
            timeout server 50000ms
            option  dontlognull
    
    listen stats :8888
            stats enable
            stats uri       /admin
            stats auth      admin:1234
    
    frontend oldboy.org
            bind 0.0.0.0:80
            option httplog
            option httpclose
            option  forwardfor
            log global
            acl www hdr_reg(host) -i www.oldboy.org
            use_backend www.oldboy.org if www
    
    backend www.oldboy.org
            server 100.1.7.9 100.1.7.9 weight 20 maxconn 3000
    
    backend buy.oldboy.org
            server 100.1.7.90 100.1.7.90 weight 20 maxconn 3000
    
    原配置文件如下
    

        文件中指定位置的添加,用户输入一个文本字典,使用json模块把文本字典进行转换。转换之后把用户输入内容添加到指定文件的位置。 

    global
            log 127.0.0.1 local2
            daemon
            maxconn 256
            log 127.0.0.1 local2 info
    defaults
            log global
            mode http
            timeout connect 5000ms
            timeout client 50000ms
            timeout server 50000ms
            option  dontlognull
    
    listen stats :8888
            stats enable
            stats uri       /admin
            stats auth      admin:1234
    
    frontend oldboy.org
            bind 0.0.0.0:80
            option httplog
            option httpclose
            option  forwardfor
            log global
            acl www hdr_reg(host) -i www.oldboy.org
            use_backend www.oldboy.org if www
    
    backend test.oldboy.org
            server 100.1.7.9 100.1.7.9 weight 20 maxconn 3000
    
    backend buy.oldboy.org
            server 100.1.7.90 100.1.7.90 weight 20 maxconn 3000
    
    1.用户输入字符串,使用json模块,将字符串转化为字典
    {"backend":
        "test.oldboy.org",
    "record":
        {"server": "100.1.7.999",
        "weight": 20,
        "maxconn": 30
        }
     }
    2.在文件指定位置添加信息。
    3.添加
    4.删除

       

      

  • 相关阅读:
    NOIP 2012 文化之旅
    史上最全的各种C++ STL容器全解析
    详解C++ STL map 容器
    详解C++ STL priority_queue 容器
    浅谈C++ STL stack 容器
    浅谈C++ STL queue 容器
    浅谈C++ STL vector 容器
    CF1185F Two Pizzas
    浅谈C++ STL deque 容器
    详解C++ STL multiset 容器
  • 原文地址:https://www.cnblogs.com/gengcx/p/6859032.html
Copyright © 2011-2022 走看看