如何制作一个PHP页面,该页面将从变量中的url指定的其他服务器返回图像,如下所示:
http://www.mypage.com/MyScript.php?src=http://www.otherpage.com/image.png
转到该页面后,图像应该会出现。
它也需要适用于任何其他 src。
(为什么这样?我想尝试绕过使用来自画布的 toDataUrl 的安全错误,同时使用不来自同一域的图像,方法是使用 http://www.mypage.com/MyScript.php?src=http://www.otherpage.com/image.png 作为画布中使用的图像 src)
你可以试试
echo file_get_contents($_GET['src']);
在MyScript.php
中,使用 $_GET['src']
作为图像的来源
<img src="<? echo $_GET['src']; ?>" />