& Lt ;? Php/*** get the real IP address of the user ** @ returnstring */functionreal_ip () {static $ realipNULL; if ($ realip! NULL) {return $ realip;} if (isset ($ _ SERVER) {if (isset ($ _ SE)
/**
* Obtain the real IP address of the user.
*
* @ Return string
*/
Function real_ip (){
Static $ realip = NULL;
If ($ realip! = NULL ){
Return $ realip;
}
If (isset ($ _ SERVER )){
If (isset ($ _ SERVER ['http _ X_FORWARDED_FOR ']) {
$ Arr = explode (',', $ _ SERVER ['http _ X_FORWARDED_FOR ']);
/* Obtain the first non-unknown valid IP string in X-Forwarded-*/
Foreach ($ arr AS $ ip ){
$ Ip = trim ($ ip );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.