count.php,代码如下:
- $aid = isset( $_GET['aid'] )?$_GET['aid']:'';
- $t = isset( $_GET['t'] )?$_GET['t']:'';
- if( intval( $aid ) )
- {
- if( $t =='show' )
- {
- echo "document.write('120');";
- }
- else
- {
- $conn = mysql_connect('www.phpfensi.com','root','root') ;
- $sql = "Update test set click_num = click_num+1 where aid ='$aid'";
- mysql_db_query('db',$sql,$conn);
- }
- }
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就行了,这样你的静态页面的访问次数你也可以把握知道了. |