PHP get the IP address of the client

By XiaoXin
A Bit Randomly

Here is an example of how you might implement a login page with Koa: First, set up your Koa application and install the necessary dependencies: npm init npm install --save koa koa-router koa-session Next, define a route fo... Read Creating Simple Login Page with KoaJS

Main Contents

PHP get the IP address of the client

What's wrong with the IP address obtained with $_SERVER?

$_SERVER['REMOTE_ADDR']; Get through the global array

getenv('REMOTE_ADDR'); Get through environment variables

When the client uses a proxy, the real IP address cannot be obtained. 


Please Share This Article Thank You!

Parts of Top Latest PHP Interview Questions And Answers For Experienced
List all the files and folders in a Directory with PHP

Write a function that can traverse all files and folders under the folder. function get_folder_info($path) { $handle = opendir($path); while(($content=readdir($handle)) !== false) { $new_dir = $path . DIRECTORY_SEPARATOR ....

PHP Magic Methods And Magic Constants

Class method:Method overloading:Attribute overloading: Serialization related: Manipulating classes and object methods:Constant: Class method: 1. __construct(); Description: A class with a constructor will call this me...