作者 ZhengBing He

test

/.idea/
... ...
FROM php:8.2-cli
COPY ./wwwroot /code
WORKDIR /code
CMD [ "php", "S", "0.0.0.0:8080"]
... ...
FROM php:8.2-cli
COPY ./wwwroot /code
WORKDIR /code
CMD [ "php", "S", "0.0.0.0:8080"]
... ...
services:
app:
image: myimage
ports:
- 8080:8080
volumes:
- ./wwwroot:/code
\ No newline at end of file
... ...
<?php
// 输出服务器的本机地址
$serverAddress = $_SERVER['SERVER_ADDR'];
echo "服务器的本机地址是:{$serverAddress}<br>";
// 输出客户端的本机地址
$clientAddress = $_SERVER['REMOTE_ADDR'];
echo "客户端的本机地址是:{$clientAddress}<br>";
?>
... ...