Home > Backend Development > PHP Tutorial > Qianlima-visitor statistics

Qianlima-visitor statistics

WBOY
Release: 2016-07-29 09:14:21
Original
1385 people have browsed it

<code>最近发现个好网站千里码,里面有很多知名公司CODER把实际工作中经常用到的技术点,或者比较有意义的问题以题目的形式重现,有兴趣的可以去看看,下面是链接地址:http://www.qlcoder.com/home
</code>
Copy after login

Every website will count visitor data based on visitor logs, such as UV. UV can answer a key marketing question: "How many people (potential customers) saw the information you published (i.e. website).
The following is based on the access log of a shopping website given in the question, and counts the UV of the website on that day. Each line of the log file represents an access behavior, and each line contains three items: the time of the user's access, the user's ID, and the user's behavior. Please tell me how many users visited this website on August 24th.

Qianlima-visitor statistics

I just learned PHP, so I wrote it using it, it’s relatively simple

<code><span><span><?php </span><span>$a</span>=<span>new</span> countt();
<span>$a</span>->cc();
<span><span>class</span><span>countt</span>{</span><span><span>function</span><span>cc</span><span>()</span>
    {</span><span>$arr</span>=<span>array</span>();
        <span>$count</span>=<span>0</span>;
        <span>$f</span>=file(<span>"uv.txt"</span>);
        <span>foreach</span>(<span>$f</span><span>as</span><span>$k</span>=><span>$v</span>)
        {
            <span>$a</span>=explode(<span>" "</span>,<span>$v</span>);
            <span>$arr</span>[]=<span>$a</span>[<span>1</span>];
        }
        sort(<span>$arr</span>);
        <span>//print_r(array_unique($arr));</span><span>echo</span> count(array_unique(<span>$arr</span>));

    }
}
<span>?></span></span></span></code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced Qianlima-Visitor Statistics, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template