Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中通过REST返回XML?_Php - Fatal编程技术网

在PHP中通过REST返回XML?

在PHP中通过REST返回XML?,php,Php,我想编写一个php脚本“test.php”,输出“sample.xml”文件的内容(适当的内容类型为:xml),就像用户直接访问“sample.xml”一样。我如何做到这一点?是否需要一些框架?不需要框架。。。仅做一点工作,以下是一个示例: test.php: <?php header("Content-Type:text/xml"); echo file_get_contents('sample.xml'); ?>

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

不需要框架。。。仅做一点工作,以下是一个示例:

test.php:

<?php
header("Content-Type:text/xml"); 
echo file_get_contents('sample.xml');
?>