【发布时间】:2016-02-04 16:22:41
【问题描述】:
我正在寻找如何在 PHP 中加载 XML 文件并返回不重定向的数据。最好尽可能对最终用户隐藏 xml 内容。
我见过这样的东西,但我不能让它工作,请如果你能用链接示例写出完整的代码..
public function sendResponse($type,$cause) {
$response = '<?xml version="1.0" encoding="utf-8"?>';
$response .= '<response><status>'.$type.'</status>';
$response = $response.'<remarks>'.$cause.'</remarks></response>';
return $response;
}
....
....
header("Content-type: text/xml; charset=utf-8");
echo sendResponse($type,$cause);
如果可以,请提供帮助。 提前致谢, SX
【问题讨论】:
-
是否要解析外部xml文件并使用php显示?