0

コピー/貼り付けのバックアップとして、xml 文字列全体 (ヘッダー、タグなどを含む) を電子メールに含めたいと考えています。以下を使用する場合:

<?php $xml_content = file_get_contents('http://www.w3schools.com/xml/note.xml'); echo $xml_content; ?>

トーベ ジャニ リマインダー 今週末は私を忘れないで!

次のような完全な文字列ではなく:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note> 
 <to>Tove</to> 
 <from>Jani</from> 
 <heading>Reminder</heading>
 <body>Don't forget me this weekend!</body>
</note>
4

2 に答える 2

3

ファイル全体を出力する場合は、ページのコンテンツ タイプを xml またはプレーンテキストに設定する必要があります。

header('Content-Type: text/xml');

または、これが機能しない場合は、

header('Content-Type: text/plain');
于 2013-10-08T09:25:44.737 に答える