public static void LogWrite(string str)
        {
//项目根目录 string path = HttpContext.Current.Server.MapPath("~") + "ilogs.txt"; if (!File.Exists(path)) { FileStream fs = new FileStream(path, FileMode.Create,FileAccess.ReadWrite); StreamWriter sw = new StreamWriter(fs); sw.Write(str); sw.Flush(); sw.Close(); } else { FileStream fs = new FileStream(path, FileMode.Append); //文本写入 StreamWriter sw = new StreamWriter(fs); sw.Write(str); sw.Flush(); sw.Close(); } }

  

 

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2022-02-25
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
相关资源
相似解决方案