我查看了XAMPP的apache的 access.log 文件:
::1 - - [29/Aug/2014:19:18:35 +0700] "GET /xampp/splash.php HTTP/1.1" 200 1325 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
::1 - - [29/Aug/2014:19:18:35 +0700] "GET /xampp/xampp.css HTTP/1.1" 200 4178 "http://localhost/xampp/splash.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
::1 - - [29/Aug/2014:19:18:35 +0700] "GET /xampp/img/blank.gif HTTP/1.1" 200 43 "http://localhost/xampp/splash.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
::1 - - [29/Aug/2014:19:18:35 +0700] "GET /xampp/img/xampp-logo.jpg HTTP/1.1" 200 19738 "http://localhost/xampp/splash.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
::1
是什么意思?我相信它意味着localhost,因为XAMPP仅用于我的PC中的本地测试。但是我也发现这些行显示127.0.0.1。
127.0.0.1 - - [30/Aug/2014:01:04:14 +0700] "GET /xampp/splash.php HTTP/1.1" 200 1325 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
127.0.0.1 - - [30/Aug/2014:01:04:14 +0700] "GET /xampp/xampp.css HTTP/1.1" 200 4178 "http://127.0.0.1/xampp/splash.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0"
那么为什么有::1
和127.0.0.1有什么不同?
答案 0 :(得分:4)
:: 1是IPv6中的本地主机地址。而127.0.0.1是IPv4中的本地主机地址。换句话说就是你。