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
  • 相关阅读:
    html5css练习 旋转
    html5 css练习 画廊 元素旋转
    html5 渐变按钮练习
    html5 旋转导航练习
    html5 javascript 表单练习案例
    html5 p1练习1,移动页面,标准标签布局
    pyqt5desinger的安装即配置
    python 文件操作
    openGL 大作业之n星变换
    openGL 蓝天白云
  • 原文地址:https://www.cnblogs.com/hualiu0/p/4521435.html
Copyright © 2011-2022 走看看