Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在HTML中使用imgage中的$\u服务器使用您的ip地址_Php_Html_Raspberry Pi - Fatal编程技术网

Php 如何在HTML中使用imgage中的$\u服务器使用您的ip地址

Php 如何在HTML中使用imgage中的$\u服务器使用您的ip地址,php,html,raspberry-pi,Php,Html,Raspberry Pi,目前,我正在设置一个Web服务器,其中包含来自我的Raspberry PI摄像头的实时流。但是,我在不同的地方使用它,我希望我的index.php自动知道他应该使用哪个IP打开相机。cam将使用myipAddress:8081/?action=stream打开。 <img src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>:8081/?action=stream" alt="Kamera" width = "640" heigh

目前,我正在设置一个Web服务器,其中包含来自我的Raspberry PI摄像头的实时流。但是,我在不同的地方使用它,我希望我的index.php自动知道他应该使用哪个IP打开相机。cam将使用my
ipAddress:8081/?action=stream打开。

<img src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>:8081/?action=stream" alt="Kamera" width = "640" height="480"
:8081/?action=stream“alt=“Kamera”width=“640”height=“480”
下面是使用$\u SERVER['SERVER\u ADDR']显示的内容;

它显示了使用我的ip地址而不是$_SERVER['SERVER\u ADDR']所显示的内容;

假设图像位于
http://IP_ADDRESS:8081/?action=stream“
。我添加了一些图片。在那里你可以看到,如果我使用,它的工作。