PHP»ñÈ¡IP
µÃµ½¿Í»§¶ËIPÀÏÎÊÌâÁË£¬µ«Õâ´Î»·¾³Óе㲻һÑù£¨ ¿Í»§ÊÇÕâÑùµÄ»·¾³Ã»°ì·¨£¬ËµBTµÄÇëÆ®¹ý :) £©¡£
win2k3¸Ãϵͳ£¨Ï³ÆϵͳA£©ÉÏ×°ÁËVMware Server£¬VMÏÂÓиöwin2k3ϵͳ(ϳÆϵͳB)¡£
ϵͳA£ºÖ±½ÓÁ¬½Ó¹«Íø¡£Óй«ÍøIP 218.72.xxx.xx¡£ºÍVMÍø¿¨µØÖ·£º192.168.222.1¡£¿ª·Å80¶Ë¿Ú,Ó³Éäµ½192.168.222.128µÄ80¶Ë¿Ú¡£
ϵͳB£ºIP£º192.168.222.128 Íø¹Ø£º192.168.222.2
VMÉèÖÃNATģʽʹµÃϵͳBÄÜ·ÃÎÊInternet¡£
ϵͳBÉÏ×°ÓÐApache+PHP¡£
ÖÁ´Ë£¬·ÃÎÊ218.72.xxx.xx:80¿ÉÒÔÖ±½ÓÁ¬½ÓϵͳBÏÂApacheÕ¾µã¡£
ÐèÇó£ºÔÚϵͳBÏ£¬PHPÕ¾µã È¡µÃ¿Í»§¶ËIP¡£ÏÖÔÚʼÖÕ»ñÈ¡µÄÊÇ£º192.168.222.1¡£
ÓÐʲô·½·¨¿ÉÒÔÔÚϵͳBÏÂÈ¡µÃ¿Í»§¶ËÕæʵIP£¿
¹Ø×¢¡£
PHP code:
//Õâ¸öº¯ÊýÄõ½Ê²Ã´ip.. Â¥Ö÷
function getIp()
{
if (@$_SERVER['HTTP_CLIENT_IP'] && $_SERVER['HTTP_CLIENT_IP']!='unknown') {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (@$_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['HTTP_X_FORWARDED_FOR']!='unknown') {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function get_client_ip() {
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
$ip = gete
Ïà¹ØÎÊ´ð£º
ASP³ÌÐòÔ±ÈçºÎתȥ×ö PHP »ò JSP
Õâ½áÌùÂÊ....
ASP ×öµÃºÃµÄ»°,תPHP,Äã»á·¢ÏÖ¸ü¼òµ¥.. ¸ü·½±ã...
²î±ð²»´óÂð
PHP²»ÊÇÒªÔÚLinux ÉÏ¿ª·¢µÄÂð WindowsÉÏÓÃÌ×¼þºÃÏñ²»Êµ¼ÊÁ˵㣬¹ãLinuxÕâ¸ö¿²¾ÍÄѹýÈ¥ÁË£¬IISÓ ......
ÇëÎÊÏÂÄܲ»ÄÜÔÙwindows϶¨ÆÚÇå¿ÕmysqlÒ»¸ö±íÖеÄÈ«²¿Êý¾Ý£¬ÓÃPHPʵÏÖ£¡
лл¸÷λÁË
¾Í±ÈÈçÒ»¸öÐÇÆÚÇå¿ÕÒ»´Î
±ÈÈçÿ¸öÐÇÆÚÁùÁãµãÇå¿ÕÒ»´Î£¡
ллÁË
¼Æ»®ÈÎÎñ...php....sql...truncate....OK
Äã¾ÍÕâ½ÓÔÚҳà ......
Ôڲɼ¯Ò»¸öÒ³ÃæµÄʱºòͨ³£¶¼ÊÇʹÓÃfile_get_contents($url)
²»¹ý·µ»ØµÄ½á¹ûÓÐʱºò»á²»È«
Èç¹ûÔÚhtmlÖÐʹÓà document.ready,ÔÚÒ³Ãæ×¼±¸ºÃºó£¬Ê¹ÓÃajax¶ÁÈ¡±ðÒ»²¿·ÖµÄÊý¾Ý
ÔÙͨ¹ýÐÞ¸Ähtml±êÇ©µÄÄÚÈÝ£¬¾Í²¿·ÖµÄÊý¾Ý¾ ......
<?php
//¾²Ì¬±äÁ¿
function myfunc(){
static $mystr;
$mystr = "¹þ";
echo $mystr."<br>\n"; ......
ÀýÈ磺
±ÈÈçÎÒµÄij¸öurl£¬
http://127.0.0.1/xxx/xxx.php?action=gg
ÊÇÈ¥Ö´ÐÐxxx.phpÖÐij¶Î´úÂë
if ($action == ....) {
...
...
return $arr;
}
¡£
ÎÒÔ ......