Skip to content

Instantly share code, notes, and snippets.

@Y5neKO
Created February 15, 2019 08:37
Show Gist options
  • Save Y5neKO/66716e8fbf7086873a3c6d665a388ddb to your computer and use it in GitHub Desktop.
Save Y5neKO/66716e8fbf7086873a3c6d665a388ddb to your computer and use it in GitHub Desktop.
PHP获取访客ip和浏览器信息
<?php
$fp = fopen("log.txt","a ");
fwrite($fp,date("Y-m-d H:i:s"));
fwrite($fp," ");
fwrite($fp,$_SERVER[REMOTE_ADDR]);
fwrite($fp," ");
fwrite($fp,get_ip());
fwrite($fp," ");
fwrite($fp,$_SERVER[HTTP_X_FORWARDED_FOR]);
fwrite($fp," ");
fwrite($fp,$_SERVER[HTTP_X_REWRITE_URL]);
fwrite($fp," ");
fwrite($fp,$_SERVER[HTTP_USER_AGENT]);
fwrite($fp," ");
fwrite($fp,$_SERVER["HTTP_REFERER"]);
fwrite($fp,"\r\n");
fclose($fp);
?>
@Y5neKO
Copy link
Author

Y5neKO commented Dec 24, 2019

收集

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment