💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 官方文档: https://www.workerman.net/doc/workerman/tcp-connection/get-remote-ip.html # 代码案例 ~~~ <?php require_once 'workerman/Autoloader.php'; use Workerman\Worker; $worker=new Worker('text://0.0.0.0:8883'); $worker->onConnect = function($connection) { echo "new connection from address ". $connection->getRemoteIp() . ":". $connection->getRemotePort() ."\n"; //获取端口与IP }; Worker::runAll(); ~~~ ![](https://img.kancloud.cn/77/ab/77abb12536cd45f7eaad286c54b6c745_1341x280.png)