首页 > 开发 > PHP > 正文

php统计静态html页面浏览访问次数代码

2024-05-04 21:58:33
字体:大 中 小
来源:转载
供稿:网友

count.php,代码如下:

  1. $aid  = isset( $_GET['aid'] )?$_GET['aid']:''; 
  2. $t = isset( $_GET['t'] )?$_GET['t']:''; 
  3. if( intval( $aid ) ) 
  4. { 
  5.  if( $t =='show' ) 
  6.  { 
  7.   echo "document.write('120');"; 
  8.  } 
  9.  else 
  10.  { 
  11.   $conn = mysql_connect('www.Vevb.com','root','root') ;   
  12.   $sql = "Update test set click_num = click_num+1 where aid ='$aid'"; 
  13.   mysql_db_query('db',$sql,$conn); 
  14.  } 
  15. } 

html代码如下:

<script language="javascript" src="count.php?aid=5&t=show"></script> 显示浏览次数

<script language="javascript" src="count.php?aid=5"></script> 增加浏览次数

我们只要把这段代码放到html页面,再把当前html 页面的id给aid就行了,这样你的静态页面的访问次数你也可以把握知道了.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表