原文地址:https://www.wjcms.net/archive...上面写了,很多人都有这样的需求,就是统计访问该网站的IP和在线人数。今天我们就来看看具体的实现方法。要让依赖的功能模块实现这个功能,需要依赖putenv()函数。可以使用以下两种方法。更改php.ini文件方法,找到php.ini文件,搜索putenv关键字,删除即可。isable_functions=passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,符号链接,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_waitwitstoppc,lpcntls,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv使用宝塔面板点击左侧软件管理,找到php,然后设置->禁用功能。删除putenv并重新启动php。实现函数在count.php同级目录下创建文件:count、temp、online。新建一个文本文件count.txt,去掉扩展名就可以计数了;在Linux系统下,请将文件属性设置为:777。文件count.php代码使用了php函数--explode、isset、empty和sprintf等:");";echo"document.write("·昨天访问:".$yesterday_c."");";echo"document.write("
");";echo"document.write("今天IP:".$today_c."");";echo"document.write("");";echo"document.write("·你访问:".$your_c."");";echo"document.write("
");";echo"文档.write("当前在线:".$total_online."");";exit;?>用JS调用文件count.php添加:
