 
TA的每日心情 | 奋斗 2019-10-18 11:20 |
---|
签到天数: 678 天 [LV.9]以坛为家II
|
php获取本地IP代码分享,直接上代码- <?php
- function get_client_ip()
- {
- if ($_SERVER['REMOTE_ADDR']) {
- $cip = $_SERVER['REMOTE_ADDR'];
- } elseif (getenv("REMOTE_ADDR")) {
- $cip = getenv("REMOTE_ADDR");
- } elseif (getenv("HTTP_CLIENT_IP")) {
- $cip = getenv("HTTP_CLIENT_IP");
- } else {
- $cip = "unknown";
- }
- return $cip;
- }
- echo "你的IP地址是:".get_client_ip();
- ?>
复制代码 效果图:
|
|