0
私はこの構造に基づいて画像の単純なXMLフィードをMVCにしようとしています。PHP構文の実行時にXMLフィードブレイクを出力する
これは、常に1から行きます - 20
<image1>http://test.url/test.jpg</image1>
<caption1>This is a test caption <caption1 />
<credit1>This is a test credit</credit1>
、ここで私のスクリプトです:
$xmlProcessor = new GalleryXMLProcessor();
$xml = $xmlProcessor->processFeed("http://testurlexport.php");
header('Content-Type: text/xml; charset=UTF-8');
echo $xml;
:変数
$xml
このようなI出力として返された
echo "<images>";
for($i = 1; $i <= 20; $i++) {
$imageUrl = "image$i";
$caption = "caption$i";
$credit = "credit$i";
echo "<image no='$i'>";
echo "<imageurl>" . $gallery->$imageUrl . "</imageurl>";
echo "<caption>" . $gallery->$caption . "</caption>";
echo "<credit>" . $gallery->$credit . "</credit>";
echo "</image>";
}
echo "</images>";
しかし、私は出力をXMLではなくテキストとして返すだけです。単にecho
と表示されます。私はChrome上にXMLビューアを持っており、XMLを意図したUIにレンダリングしません。私は、画像を追加することを開始する前に、これはうまくいきました(下記参照)のエコーは、テキスト/ XMLを返すよう