如何在 PHP 中回顯 XML 檔案
HTTP URL 可以透過 PHP 包裝器像本地檔案一樣使用。可以使用 file_get_contents() 提取來自 URL 的內容,並且可以使用 readfile 函式回顯或讀取該內容。
下面是一個示例程式碼演示了這一點 −
$file = file_get_contents('http://example.com/');
echo $file;下面演示了另一種方法 −
readfile('http://example.com/');
header('Content-type: text/xml'); //The correct MIME type has to be set before displaying the output.也可以使用 asXML 方法。下面是一個示例程式碼 −
echo $xml->asXML();
or
$xml->asXML('filename.xml'); //providing a name for the xml file.
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP