我尝试根据地址嵌入谷歌地图。
<iframe src="<?= $map_src ?>" width="500" height="100%" frameborder="0" style="border:0" allowfullscreen=""></iframe>
当我使用此地址时,地图会显示:
$map_src = "https://www.google.ca/maps?q=spa810+33535 Peachtree Rd. NE, Suite 530+Atlanta+GA&z=17&iwloc=near&output=embed";
然而,当我尝试使用另一个时。它显示了错误
$map_src = "https://www.google.ca/maps?q=spa810+32222+McKinney+Ave+#120+Dallas+TX&z=17&iwloc=near&output=embed";
Refused to display 'https://www.google.ca/maps?q=spa810+2222+McKinney+Ave+#120+Dallas+TX&z=17&iwloc=near&output=embed' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
我真的不确定在这种情况下会发生什么。有什么想法吗?