zxrs.png

方法

打开 /usr/themes/handsome/comment/sidebar.php 文件,然后大约在132行左右

 <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.1/css/all.min.css"rel="stylesheet">
   <?php
    $online_log = "slzxrs.dat";
    $timeout = 30;
    $entries = file($online_log);
    $temp = array();
    for ($i=0;$i<count($entries);$i++){
        $entry = explode(",",trim($entries[$i]));
        if(($entry[0] != getenv('REMOTE_ADDR')) && ($entry[1] > time())) {
            array_push($temp,$entry[0].",".$entry[1]."\n");
        }
    }
    array_push($temp,getenv('REMOTE_ADDR').",".(time() + ($timeout))."\n");
    $slzxrs = count($temp);
    $entries = implode("",$temp);
    $fp = fopen($online_log,"w");
    flock($fp,LOCK_EX);
    fputs($fp,$entries);
    flock($fp,LOCK_UN);
    fclose($fp);
    $tj=$slzxrs."人";
    ?>
     <li class="list-group-item text-second">
    <i class="fa fa-user"aria-hidden="true" style="margin-right:5px"></i>
    <span class="badge
           pull-right"><?php echo $tj?></span>在线人数
</li>

把上面的代码添加进去就可以了

END
本文作者:
文章标题:handsome博客信息添加在线人数
本文地址:http://blog.imjunjun.cn/archives/38/
版权说明:若无注明,本文皆军军's Blog原创,转载请保留文章出处。
Last modification:April 21, 2022
如果觉得我的文章对你有用,请随意赞赏