zoukankan      html  css  js  c++  java
  • .net 网站首页,本次的项目中用到的一个网站首页中统计网页访问量的工具方法,我觉得它应该在pagebase里面,拿来用一下

    需要建立一个根文件夹 ~/xml/couter.txt

    #region 网站访问量         protected void pageviews() {             int count = 0;             //数据累加             int Stat = 0;             StreamReader srd;             //取得文件的实际路径             string file_path = Server.MapPath("/XML/counter.txt");             //打开文件进行读取             srd = File.OpenText(file_path);             while (srd.Peek() != -1) {                 string str = srd.ReadLine();                 count = int.Parse(str);             }             srd.Close();             // 在新会话启动时运行的代码             Application.Lock();             //获取Application对象中保存的网站总访问量             Stat = count;             Stat += 1;             object obj = Stat;             Application["counter"] = obj;             //将数据记录写入文件             StreamWriter srw = new StreamWriter(file_path, false);             srw.WriteLine(Stat);             srw.Close();             Application.UnLock();         }         #endregion
  • 相关阅读:
    JZOI 4020 Revolution
    JZOJ 4018 Magic
    JZOJ 4017 逃跑
    JZOJ 4016 圈地为王
    JZOJ 4015 数列
    JZOJ 3960 鸡腿の出行
    BZOJ 5005 & JZOI 3959 鸡腿の乒乓
    GCJ2009B&JZOJ 4033 Min Perimeter
    jzoj 3948 Hanoi 塔
    [纯符][纯粹的无聊] 神奇的递推式
  • 原文地址:https://www.cnblogs.com/hualiu0/p/4521435.html
Copyright © 2011-2022 走看看