我有以下XML
文件:XML解析錯誤:沒有很好地形成,在FF
<?xml version="1.0" encoding="UTF-8"?>
<?php
header('Content-type: application/xml');
require_once('includes/pdo_connection.php');
$query = "Select * from photo_category WHERE status='A'";
$result = DB::instance()->prepare($query)->execute()->fetchAll();
$output="<juiceboxgallery galleryTitle='FutureFit Gallery'>";
foreach($result as $row) {
$cat_id = $row['id'];
$cat_name = $row['photo_category_name'];
$query2 = "Select * from photogallery WHERE pcID = '$cat_id' AND status = 'A' order by id desc";
$result2 = DB::instance()->prepare($query2)->execute()->fetchAll();
foreach($result2 as $row2) {
$imgCaption = $row2['img_label'];
$thumb = $row2['thumb_img'];
$large = $row2['photo_gallery_image'];
$output .= "<image imageURL='images/photogallery/large/$large'
thumbURL='images/photogallery/thumb/$thumb'
linkURL=''
linkTarget='_blank'>
<title>".$imgCaption."</title>
</image>";
}
}
$output .= "</juiceboxgallery>"; ?>
<?php echo $output; ?>
而在.htaccess
我使用如下:
<IfModule mod_php5.c>
<FilesMatch "\.xml$">
SetHandler application/x-httpd-php
</FilesMatch>
</IfModule>
現在,當我運行這個XML
我服務器我得到錯誤,XML
格式不正確。錯誤是如下:
XML Parsing Error: not well-formed
$output= '<juiceboxgallery galleryTitle="FutureFit Gallery">';
而在Chrome瀏覽器中的錯誤說:
error on line 6 at column 50: Document is empty
請幫我解決這個問題。
看看這個[thread] [1]我想你會從那裏找到你的解決方案。 [1]:http://stackoverflow.com/questions/4075742/regex-to-strip-html-tags – 2014-09-10 08:24:50