Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写一个 php 脚本“test.php”,它输出“sample.xml”文件的内容(具有适当的 Content-Type:xml),就像用户直接访问“sample.xml”一样。我该如何做到这一点?是否需要一些框架?
不需要框架......只需使用header进行一点工作,这是一个示例:
测试.php:
<?php header("Content-Type:text/xml"); echo file_get_contents('sample.xml'); ?>