0
加載頁面時,我得到這個錯誤,在谷歌搜索沒有運氣..PHP:XML解析錯誤:沒有很好地形成
XML Parsing Error: not well-formed
Location: //URL
Line Number 7, Column 103:
(這只是部分代碼,非常simplized。)
<?php
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
echo <<<html
<html>
<head>
<title>Map Project</title>
<meta charset="utf-8">
<script src=http://maps.googleapis.com/maps/api/js?key=AIzaSyDX319H1v1c6xxiVZm-PTuADCnKLZo&sensor=false"></script>
</head>
<body onload="localStorage.clear();">
html;
// DB Connection codes goes here..
$query= "SELECT * FROM `mapx`";
$result = mysqli_query($dbc,$query);
if (!$result) {
echo 'ERROR!';
}
header("Content-type: text/xml");
echo '<markers>';
while ($row = @mysqli_fetch_assoc($result)){
echo '<marker ';
echo 'name="' . parseToXML($row['user']) . '" ';
echo 'lat="' . $row['lat'] . '" ';
echo 'lng="' . $row['lng'] . '" ';
echo '/>';
}
echo '</markers>';
echo <<<html
//other parts..
</body>
</html>
html;
?>
的錯誤指向它的一部分:
sensor=[HERE]false
編輯,並在同一個地方/同樣的錯誤仍然指向。 –
我會測試這個。謝謝。 –
好的沒問題 –