我在 CakePHP 中遇到了一个非常令人沮丧的问题,在我的 KML 文件布局的开头不断出现一个空格,这导致 Google Earth 拒绝 KML 文件!
<?php header("Content-disposition: attachment; filename=area.kml");
header("Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf8");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<?php echo $content_for_layout ?>
</Document>
</kml>
对于我得到的输出
" <?xml version="1.0" encoding="UTF-8"?>"
等等请帮忙!