[英]would like to create a .php file that reads an .xml file and delivers xml output from the .xml file
我知道這聽起來很奇怪,但是我需要它來解決。
因此,ActionScript中的某些鏈接指向.php文件。 由於無法在AS中編輯此鏈接,因此需要一些解決方法。 我有xml,而.php文件需要輸出該確切的xml代碼。 如何才能做到這一點。 最終,我想創建一個輸出xml的.php腳本。 在哪里可以找到有關如何執行此操作的說明? 謝謝!
如果我對您的理解正確,則應按照以下要求進行操作:
<?php
$xmlContent = file_get_contents('/path/to/xml/file');
header('Content-type: text/xml; charset=utf-8');
if ($xmlContent) {
// file available
echo $xmlContent;
exit();
}
// indicate failure, e.g.
echo '<?xml version="1.0" encoding="utf-8?>
<result>
<status success="0">
</result>';
您的意思是這樣的嗎:
header( 'Content-Type: text/xml', true );
readfile( '/path/to/your/xml/file.xml' );
( Cez的回答肯定是更多的錯誤證明)
還是意味着您需要首先從文件中調整一些xml? 在這種情況下,您可能需要查看以下一項(或多項):
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.