0

我想编写一个 php 脚本“test.php”,它输出“sample.xml”文件的内容(具有适当的 Content-Type:xml),就像用户直接访问“sample.xml”一样。我该如何做到这一点?是否需要一些框架?

4

1 回答 1

2

不需要框架......只需使用header进行一点工作,这是一个示例:

测试.php:

<?php
header("Content-Type:text/xml"); 
echo file_get_contents('sample.xml');
?>
于 2012-05-09T02:39:40.993 回答