PHP文件从另一台服务器获取内容,实际工作在哪里完成?
如果我正在浏览此网页:www.example1.com/1.php,php代码如下所示:PHP文件从另一台服务器获取内容,实际工作在哪里完成?,php,html,Php,Html,如果我正在浏览此网页:www.example1.com/1.php,php代码如下所示: <?php echo file_get_contents("http://www.example2.com/2.php"); ?> www.example2.com/2.php代码如下: <?php echo file_get_contents("http://www.example3.com"); ?> <html> <body> <
<?php
echo file_get_contents("http://www.example2.com/2.php");
?>
www.example2.com/2.php代码如下:
<?php
echo file_get_contents("http://www.example3.com");
?>
<html>
<body>
<h1>Hello</h1>
</body>
</html>
和www.example3.com html代码如下:
<?php
echo file_get_contents("http://www.example3.com");
?>
<html>
<body>
<h1>Hello</h1>
</body>
</html>
你好
这项工作是通过让域example1.com的服务器完成example3.com html代码来完成的,还是域example2.com的服务器都参与了从example3.com收集数据
我的意思是,例如example2.com,服务器是否准确地对example3.com中的任何数据进行了网关化,或者它只是将自己的PHP代码传递给example1.com。然后example1.com服务器自己运行example2.com PHP代码并从example3.com收集数据?PHP是服务器端预处理器,因此没有实际的PHP代码从一台服务器传递到另一台服务器,只有最终处理的HTML 因此,在您的示例中,
www.example3.com
包含实际的HTML代码
www.example2.com
只是重复了www.example3.com
的内容
www.example1.com
正在回显www.example2.com
的内容,这是从www.example3.com
获取数据的处理结果
example1
永远不要接触example3
或者知道任何关于它的事情。永远不会传递PHP代码。它传递的是最终的html,任何PHP都不会显示给外界。