我是网络开发的新手,并试图通过 php 制作 xml 以在我的 flash 库中使用,并在检查我的 php 文件时收到此错误:
此页面包含以下错误: 第 3 行第 84 列的错误:重新定义属性 THUMB 下面是页面的呈现直到第一个错误。
这是代码:
<?php
// Set which extensions should be approved in the XML file
$extensions = array
(
'jpg', 'JPG',
'png', 'PNG',
'gif', 'GIF',
'bmp', 'BMP'
);
// Echo the header (XML)
header("Content-Type: text/xml");
// Prepare the XML file
echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\r\n";
echo '<GALLERY COLUMNS="5" XPOSITION="30" YPOSITION="30" WIDTH="100" HEIGHT="100">' . "\r\n";
$gallery = '<IMAGE FULL="';
// Get the files from the current directory
if (file_exists ("full_images/"))
{
if (is_dir ("full_images/"))
{
$dh = opendir ("full_images/") or die (" Directory Open failed !");
// Prepare the images array
$imgs = array();
while ($file = readdir ($dh))
{
// Only get the files ending with the correct extension
if ( in_array( substr($file, -3), $extensions ) )
{
array_push($imgs, $file);
}
}
closedir ($dh);
}
// Sort the array
sort($imgs);
foreach ($imgs as $img)
{
// Return all images in XML format
$gallery.= 'full_image/' .$img . '" ' . 'THUMB="';
}
}
// Get the files from the current directory
if (file_exists ("thumbs/"))
{
if (is_dir ("thumbs/"))
{
$dh = opendir ("thumbs/") or die (" Directory Open failed !");
// Prepare the images array
$thumbs = array();
while ($file = readdir ($dh))
{
// Only get the files ending with the correct extension
if ( in_array( substr($file, -3), $extensions ) )
{
array_push($thumbs, $file);
}
}
closedir ($dh);
}
// Sort the array
sort($thumbs);
foreach ($thumbs as $thumb)
{
// Return all images in XML format
$gallery.= 'thumbs/' . $thumb;
}
}
$gallery.= '" />';
$gallery.= "\r\n";
echo $gallery;
echo "</GALLERY>";
?>
我哪里错了?解决方案是什么?谢谢你。