zoukankan      html  css  js  c++  java
  • html 模板替换

    public void OffAddModel()
    {
    string title = Request["title"];//标题
    string sendTime = Request["sendTime"];//发布时间
    string originalUnit = Request["originalUnit"];//官方部门
    string link = Request["link"];//超链接
    string fujian = Request["fujian"];//附件
    string fujianUrl = Request["fujianUrl"];//附件路径
    string conter = Request["conter"];//内容

    string path = Server.MapPath("OffAddModel.html");//取到模板的物理路径
    StreamReader sr = new StreamReader(path, Encoding.UTF8);
    string strModel = sr.ReadToEnd();
    strModel = strModel.Replace("$title", title);
    strModel = strModel.Replace("$sendTime", sendTime);
    strModel = strModel.Replace("$originalUnit", originalUnit);
    strModel = strModel.Replace("$conter", conter);
    strModel = strModel.Replace("$link", link);
    strModel = strModel.Replace("$fujian", fujian);
    strModel = strModel.Replace("$fujianUrl", fujianUrl);

    FileStream ff = new FileStream(path.Replace("OffAddModel", "aa"), FileMode.CreateNew);
    byte[] buffer = Encoding.UTF8.GetBytes(strModel);
    ff.Write(buffer, 0, buffer.Length);
    ff.Close();
    }

  • 相关阅读:
    第05组 Alpha冲刺(2/4)
    Alpha冲刺(1/4)
    第04组 Beta冲刺(4/4)
    第04组 Beta冲刺(3/4)
    第04组 Beta冲刺(2/4)
    第04组 Beta冲刺(1)
    第04组 Alpha事后诸葛亮
    第04组 Alpha冲刺(4/4)
    第04组 Alpha冲刺(3/4)
    第04组 Alpha冲刺(2/4)
  • 原文地址:https://www.cnblogs.com/xwchengc/p/4708628.html
Copyright © 2011-2022 走看看