How do I find my server's IP address in PHP(CLI)

前端 未结 6 1048
梦谈多话
梦谈多话 2020-12-13 09:12

Aside from the obvious (localhost, 127.0.0.1) does PHP (command line interface!) have a mechanism for discovering the IP of the computer the script is running on?

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 09:46

    If all else fails, you could always exec ipconfig or ifconfig, depending on your platform, and parse the result.

提交回复
热议问题