php - googlemaps 文档类型错误

标签 php javascript google-maps doctype

我在尝试显示 googlemaps 时遇到错误

如果我加载 googlemaps javascript 源

我在 Firebug 中得到这个错误

syntax error
[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\nmaps?fil...sor=false (regel 1)

我有这个来加载文件

<?php if (isset($gmap))?><script type="text/javascript" src="<?php echo __PUBLIEK_PAD; ?>/js/<?php echo $gmap; ?>"></script>

这是我如何设置变量

$key='my-api-key';
$this->view->gmap="http://maps.google.com/maps?file=api&v=2&key=".$key."&sensor=false";
$this->view->js_gmaptest = 'gmaptest.js';

这里有什么东西会导致问题吗? 我以前让它工作过,但我知道我不再知道了。

谢谢,理查德

最佳答案

不确定是否是问题所在,但 documentation说你的文件的开头应该是这样的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

关于php - googlemaps 文档类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2127601/

相关文章:

javascript - 从 D3 v3 改编到 v5 的代码需要额外更新才能正确呈现

javascript - 当模式处于事件状态时,传单 map 仍然存在。为什么?

java - 是否有可能获得从标准谷歌地图导航到我们的应用程序到达目的地的估计时间?

java - 谷歌地图坐标转义

php - Laravel 5 SSL - 使用过时的密码学加密

php - 未知 : Failed opening required on line 0. laravel 5.6

javascript - ember 根据经过身份验证的用户设置用户对象

google-maps - 如何使 openInfoWindowHtml 在 Google Maps 2 中工作

php - 选中复选框时隐藏表格行

php - 使用 imagick 使用 PHP 将 PDF 转换为 JPG 适用于平面 pdf,但在有多个图层时失败