How to identify server IP address in PHP

后端 未结 15 964
温柔的废话
温柔的废话 2020-11-29 23:52

How can I identify the server IP address in PHP?

15条回答
  •  被撕碎了的回忆
    2020-11-30 00:13

    I came to this page looking for a way of getting my own ip address not the one of the remote machine connecting to me.

    This will not work for a windows machine.

    But in case someone searches for what I was looking for:

    #! /usr/bin/php
    

    (Shamelessly adapted from How to I get the primary IP address of the local machine on Linux and OS X?)

提交回复
热议问题