Home > php教程 > php手册 > php统计静态html页面浏览访问次数代码

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

WBOY
Release: 2016-05-25 16:42:17
Original
1820 people have browsed it

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.phprm.com','root','root') ;   
        $sql = "Update test set click_num = click_num+1 where aid ='$aid'"; 
        mysql_db_query('db',$sql,$conn); 
    } 
}
Copy after login

html代码如下:

显示浏览次数

增加浏览次数

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


文章地址:

转载随意^^请带上本文地址!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template