这篇文章主要介绍了php实现统计IP数及在线人数的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
web
写在前面的话
很多人有这样的需求,就是统计网站访问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,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,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即可。
实现函数