作者 ZhengBing He

test

  1 +/.idea/
  1 +FROM php:8.2-cli
  2 +COPY ./wwwroot /code
  3 +WORKDIR /code
  4 +CMD [ "php", "S", "0.0.0.0:8080"]
  1 +FROM php:8.2-cli
  2 +COPY ./wwwroot /code
  3 +WORKDIR /code
  4 +CMD [ "php", "S", "0.0.0.0:8080"]
  1 +services:
  2 + app:
  3 + image: myimage
  4 + ports:
  5 + - 8080:8080
  6 + volumes:
  7 + - ./wwwroot:/code
  1 +<?php
  2 +// 输出服务器的本机地址
  3 +$serverAddress = $_SERVER['SERVER_ADDR'];
  4 +echo "服务器的本机地址是:{$serverAddress}<br>";
  5 +
  6 +// 输出客户端的本机地址
  7 +$clientAddress = $_SERVER['REMOTE_ADDR'];
  8 +echo "客户端的本机地址是:{$clientAddress}<br>";
  9 +?>