将外部网页加载到我的页面而不重定向到不同的URL

Jor*_*J.D 11 html php iframe redirect external

所以我想要做的是在我的网站上创建一个子域名,让它加载一个外部网站,而不是真正去那个网站.例如:

google.mydomain.com加载了google.com,但网址栏中显示的是google.mydomain.com.

我该怎么做呢?

我尝试了这个,但无法弄明白.

试:

IFRAME

  1. 我希望页面占据每个人计算机的整个屏幕.我可以将其设置为100%而不是x像素数量吗?

  2. 我想删除滚动条,但它说不支持.

Con*_*ney 17

您可以使用iframe或file_get_contents();

IFRAME:

<iframe src="http://google.com" style="width: 100%; height: 100%;">
Run Code Online (Sandbox Code Playgroud)

file_get_contents()函数:

<?php
echo file_get_contents('http://google.com');
?>
Run Code Online (Sandbox Code Playgroud)

使用file_get_contents(),您需要注意使用相对URL获取的网站,这将破坏CSS,图像,Javascript等.