简单的pv统计

本来想存表的,想了想还是这样减轻点数据库压力吧

// pv统计
    private function pv($m,$name){
        $uid = $_SESSION['UserId']?$_SESSION['jx_uuid']:0;
        if(is_file('pvlog/'.$m.'/'.$name.".txt")){

            $count=file_get_contents('pvlog/'.$m.'/'.$name.".txt");


            $count = $count.'/@!#%/'.time().'--||--'.$uid;


            file_put_contents('pvlog/'.$m.'/'.$name.".txt", $count);

            }else {
                  file_put_contents('pvlog/'.$m.'/'.$name.".txt",time().'/-/'.$uid);
            }
    }
image.png

你可能感兴趣的:(简单的pv统计)