public void SetLog(string content)
        {
            string hh = Server.MapPath("/log/") + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            if (!File.Exists(hh))
            {
                string dir = Path.GetDirectoryName(hh);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }
            FileStream fs = new FileStream(hh, FileMode.Append, FileAccess.Write, FileShare.Read);
            StreamWriter sw = new StreamWriter(fs);
            sw.WriteLine(content);
            sw.Close();
            fs.Close();
        }

  

相关文章:

  • 2021-05-29
  • 2021-10-08
  • 2021-09-16
  • 2021-05-17
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2021-12-21
  • 2022-12-23
  • 2021-11-11
  • 2019-03-04
  • 2021-11-17
相关资源
相似解决方案